An Implementation of a reactive linear gradient picker made with SwiftUI
I tried to annotate everything so that it is understandable. Even though its explained throughout the code this is still a very difficult component to understand. A lot of the geometry is assumed to be implicitly understood, so if you dont know to find the angle of a line, just know it is the arctan of the slope ( atan(dy/dx) = angle ). Also it is good to understand the different ways you can represent a line. y = mx + b or P = (P_2-P_1)t + P_1. Make sure you know your geometry before attempting to dissect this, otherwise you are gonna get womped. Happy Picking!