HomeiOS Developmentios - What's the workaround for utilizing the @Observable and @Enviorment Macro...

ios – What’s the workaround for utilizing the @Observable and @Enviorment Macro as a part of the Apple SwifftUI Tutorial?


When utilizing these macros, I obtain the next errors:

@Observable Concern: Unknown attribute ‘ObservableObject’

@Setting Concern: Can’t convert worth of kind ‘ModelData.Kind’ to anticipated argument kind ‘KeyPath<EnvironmentValues, Worth>’, Generic parameter ‘Worth’ couldn’t be inferred

On the next web page link-to-page at Step 2 of Part 4, I’m informed to do the next :

Step 2: Declare a brand new mannequin kind utilizing the Observable() macro.

after which I’m informed to the next on Step 3:
In LandmarkList, add an @Setting property wrapper to the view, and an surroundings(_:) modifier to the preview.

I’ve tried setting my class to stick to the ObservableProtocol and setting my var landmarks to @Printed as per one other stack overflow submit, however I have no idea what I’m doing nor what it meant. It appeared to take away the error message although for the @Observable subject.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments