I'm trying to develop an iOS app with SwiftUI supporting iOS15 and above and then I encounter with this issue.
I have a SwiftUI view and call this view from multiple different UI flows. So I want to provide different environment objects depending which flow it is in. I want them optional because depending which environment object I am able to retrieve, I want to modify properties of those environment objects to trigger UI updates. (expect to use "if let" check for optional binding)
Inside that view, I want to retrieve those environment objects as optionals but I can't use @EnvironmentObject because is expects conforming ObservableObject protocol. I also tried to use EnvironmentKey protocol to define custom optional types but this time Xcode gives error as:
"Failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs)"
I really wonder If I am able to reach an optional environment object for iOS15.
Note: I know that with Observation framework I may be able to get optional environment object but I have to update my supported iOS level beginning from iOS17 for the app which I can't do right now.
Post
Replies
Boosts
Views
Activity
Apple mentions that they are willing to support developers on various platforms. One of them is VS Code. I just wonder if Apple tries to give official support for Xcode project files like the extension below.
https://marketplace.visualstudio.com/items?itemName=mariomatheu.syntax-project-pbxproj
We can download and use this extension, yes but I just wonder if Apple considers to publish any extension like above on VSCode marketplace officially?