Hey!
First of all, at the moment, your UI code looks pretty good, nothing stands out to me as bad or wrong. What I think you need to do is to draw the expected design somewhere, like a paint app, or more professional and suited apps like Figma or photoshop. From what I can see on the image, nothing should be too hard to do after that, except maybe for the slider-textfield control you want to have. AFAIK, there's no such standard view, so you would need to create your own, or you can use a slider, as you proposed in the notes.
Another thing you might want to do is check the standard library of views and especially styles because views like picker can have multiple styles, almost unrelated to one another. After that, you will understand more clearly what you can use right off the bat, and what you do customly.
The multiple disclosure thing you want to have is also correctly done with ForEach
view, though you need to make your view model (Settings) reflect that might have multiple rings. That means ringRadiusFraction
should be an array of Double
s. Btw, you don't need to initialize Double like Double(0.5)
. The default floating-point literal is Double
already.
Then, ForEach
will look like ForEach(0..<ringRadiusFraction.count, id: \.self) { ... }
. This is a not-so-good solution, but it will do for the first time. If you want to enhance it in the future, you will need to generate, or somehow assign unique IDs to the rings themself, which have to become Identifiable
structs.
Swipe actions are another kind of tricky part, but only pre macOS 12. Delete action can be made available on any version of SwiftUI if your ring settings will be rendered as List
, instead of ForEach
and using onDelete
view modifier. More info here.
As for duplicate and any other swipe actions, the easy way is only available for macOS 12+ using swipeActions
view modifier, before that, I would guess the easiest option would be to resort back to UIKit for this specific part.
The last thing is about moving values around the app. Again, you here already done pretty much everything needed here, your ContentView
holds the reference to the Settings
object, passing it to SettingsView
, which manipulates it. Your ArenaScene
receives updates, just by virtue of Settings
being a reference type. One thing here is I don't think @ObservedObject
in ArenaScene
does anything, though I have not dealt with SpriteKit to tell for sure.
I hope that helps somewhat and you will get through your struggles and materialize the idea that you have :)