Post

Replies

Boosts

Views

Activity

Reply to Popover in SwiftUI is showing a sheet. Anyone else?
I can confirm this is still the behaviour on iOS 16. Its a shame because popover bubbles are very common on iOS for providing users with tutorials on how to use the app. This should be fixed. If you wanted to show a sheet instead of a popover on iPhone, you could easily just create a view modifier that does the existing behaviour.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’23
Reply to SwiftUI Navigation Stack pops back on ObservableObject update
This is because your observable object is being used by both a view that is hosting a navigation view, and one of the children being presented by a navigation view. So when the child updates the observable object, it causes the parent to reload. Which in turn causes its navigation stack to be drawn from scratch as well. the solution is to decouple the parent from the observable object. So it’s not reloading each time it changes. A technique I use is to wrap an observable object inside another. What this does it it allows me to inject them via @EnvironmentObject, without causing the views to reload unnecessarily. class Dependency<T: ObservableObject>: ObservableObject { let observable: T init(observable: T) { self.observable = observable } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’22
Reply to Command CompileAssetCatalog failed with a nonzero exit code
I seem to have solved the issue. Purged Xcode from my machine again. Including all caches. Deleted the contents of the /Library/Developer folder restarted my machine installed command line tools with Xcode-select --install redownloaded Xcode I think the PrivateFrameworks folder inside of /Library/Developer/ was the culprit. Its last modified time was when I installed Xcode 14 beta, not the last time I reinstalled Xcode 13.4.1 I imagine some of the stuff the simulator runtime relies on was corrupted.
Jul ’22
Reply to How do I use async/await with NotificationCenter?
I figured out what was wrong with it: this was what I was doing: for await _ in NotificationCenter.default.notifications(named: UIDevice.orientationDidChangeNotification, object: self) { print("orientation changed") // This would never fire } I changed it to: for await _ in NotificationCenter.default.notifications(named: UIDevice.orientationDidChangeNotification) { print("orientation changed") // This works } I guess I misunderstood what that object param was used for.
Topic: Community SubTopic: Apple Developers Tags:
Nov ’21