Discover Observation in SwiftUI

RSS for tag

Discuss the WWDC23 Session Discover Observation in SwiftUI

Posts under wwdc2023-10149 tag

1 Post

Post

Replies

Boosts

Views

Activity

@Observable and didSet?
I'm in the process of migrating to the Observation framework but it seems like it is not compatible with didSet. I cannot find information about if this is just not supported or a new approach needs to be implemented? import Observation @Observable class MySettings { var windowSize: CGSize = .zero var isInFullscreen = false var scalingMode: ScalingMode = .scaled { didSet { ... } } ... } This code triggers this error: Instance member 'scalingMode' cannot be used on type 'MySettings'; did you mean to use a value of this type instead? Anyone knows what needs to be done? Thanks!
11
3
4.5k
Jan ’25