Creating the target and guess circles
The next task is to create two colored circles:
- One circle will be the target circle, which will show a randomly generated color; because it is an RGB color, the user will need to combine three RGB values to find this target color.
- The other circle will be their “guess” circle – kind of like a sketchpad, where the user can see their current progress as they manipulate the sliders.
These two circles will be created in their own SwiftUI file, so let’s make them now. Press Command + N, select SwiftUI View, and call it TargetAndGuessCircleView
.
We want to use this file inside of ContentView
– in order to do so, we will need some Binding
variables inside the struct:
struct TargetAndGuessCircleView: View { //target variables @Binding var redTarget: Double @Binding var greenTarget: Double @Binding...