Post

Replies

Boosts

Views

Activity

Reply to Still wondering about objectWillChange (vs objectDidChange) magic :)
My assumption is it works similar to UIView’s/NSView’s setNeedsDisplay() (docs) - https://developer.apple.com/documentation/uikit/uiview/1622437-setneedsdisplay: The view is not actually redrawn until the next drawing cycle, at which point all invalidated views are updated. So objectWillChange schedules an update, which occurs in SwiftUI’s equivalent of the next drawing cycle.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’20