Post

Replies

Boosts

Views

Activity

How to update one View when another view changed object property?
Good (morning, evening...). I try to build SwiftUI view hierarchy for model where: I have many Glyph objects: var manager: CoordinatesManager var elements: [ ManyMultidimensionalElements ] var path: Path { return Path(..based on elements and manager.currentCoordinates) } I have one CoordinatesManger: var currentCoordinates: [ Coordinate ] In one view I can set currrentCoordinates of CoordinatesManager, in second view I want to see Glyph with actual glyph.manager.currentCoordinates It almost works but:changing manager.currentCoordinates doesn't change GlyphView, even if Glyph object see manager.currentCoordinates was changed (in manger.didSet{...}) When scrolling (why?) glyph.path is recalculated, but View stays untouched. Example Playground - https://developer.apple.com/forums/content/attachment/507e87de-2094-4998-8361-b3c1dd21549c How to push View to redraw? Something like NSView.needsDisplay. How to trigger View to redraw, when glyph.manager.currentCoordinates are changed? PS. It's my first post on this forum, I don't know what's the best: hide Playground file as attachment or list it in main text.
1
0
685
Jul ’20