Bindings in superview was defined inside body.
Post
Replies
Boosts
Views
Activity
For now like this, in a simplest way
struct ContentView: View {
@ObservedObject var manager = Manager()
var body: some View {
...
VStack {
ScrollView([.horizontal, .vertical]) {
DotTestView(dots: $manager.dots)
.frame(width: manager.size.width,
height: manager.size.height)
}
HStack {
Button(action: {
Task {
await manager.updateDots(in: manager.size)
}},
label: {Text("start")})
Button(action: {
print ("stop")},
label: {Text("How to Stop")})
}
}
...
}
}
Manager keeps all configuration data, has @Published var dots:[Dot]. Simple as that.
And a problem is that Rainbow Wheel does not allow me to touch any Button. I suspect:
@MainActor
public struct DotGenerator {....}
but I don't know how to make it different way in Swift6
Instead of using GeometryReader and SwiftUI structs for dot shape, I used Canvas and draw paths into its context
Those circles are defined in brown noise random positions and sizes, but generated PDF has visible grid, many circles are became elipses. Smallest circle in picture has size 1pt x 1pt.
I hope this is an ID: FB15716546
Thanks, it look promising. But if I use this code (filled dots with {print ("hello")} and Text("..."), app hangs up and prints in console:
2020-11-20 11:44:39.064295+0100 GlyphDesigner[45633:2671193] [Layout] Unable to simultaneously satisfy constraints:
"<NSAutoresizingMaskLayoutConstraint:0x60000119abc0 h=-&- v=-&- _NSTextContentView:0x7fee4561c870.minX == 0 (active, names: '|':NSTextView:0x7fee45673c80 )>",
"<NSAutoresizingMaskLayoutConstraint:0x60000119ada0 h=-&- v=-&- H:[_NSTextContentView:0x7fee4561c870]-(380)-| (active, names: '|':NSTextView:0x7fee45673c80 )>",
"<NSAutoresizingMaskLayoutConstraint:0x60000119ae90 h=--& v=--& NSTextView:0x7fee45673c80.width == 318 (active)>"
)
Will attempt to recover by breaking constraint
<NSAutoresizingMaskLayoutConstraint:0x60000119ada0 h=-&- v=-&- H:[_NSTextContentView:0x7fee4561c870]-(380)-| (active, names: '|':NSTextView:0x7fee45673c80 )>
Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens. And/or, set a symbolic breakpoint on LAYOUT_CONSTRAINTS_NOT_SATISFIABLE to catch this in the debugger.
But I have no idea where to set constrains in this case.