Post

Replies

Boosts

Views

Activity

Reply to Navigation: update multiple times per frame
I am also seeing the same message. In a mirror situation (almost identical code in a Row/Detail situation where rows navigate to editor details), everything works fine. But in the second situation, I get the message "Update NavigationRequestObserver tried to update multiple times per frame" and 100% CPU hang. I've ripped out everything, so there's barely anything going on, and the problem persists. The differentiator between hangs/doesn't hang seems to be whether a closure in the editor (and one that has not even been invoked) captures a state variable in that editor (View). This makes no sense to me. There must be some strange stuff going on behind the scenes. I have tried Button vs Navigationlink, to no avail. For now, I also have to conclude this is a swift or swiftUI bug. FWIW, I am using a NavigationStack with a NavigationPath to control it. I'm always using .navigationDestination to set up the hierarchy. Xcode Version 14.2 (14C18)
Jan ’23
Reply to Accessing code from SharedCode.swift in UserModule from Main Playground
Ah. It seems that as a function defined in a module, it won't be visible without being prefixed with public, like so: public func hello() { print("hello") } I found this out by watching the Swift Playgrounds 3 video from WWDC 2019. Once I had that basic step, I knew what sort of thing to look up. From there I figured out that I'd get more relevant information in the "Access Control" chapter of "The Swift Programming Language" book that Apple publishes. It is really hard to know where to look for information, sometimes! I hope this helps someone else.
Sep ’22
Reply to Video describing swiftUI layout process
Oh, I think I’ve found it. There’s lots of good layout information in “Building Custom Views with SwiftUI” from WWDC 2019. Additionally, for future me, when I’m looking to solve layout problems, I would say that topics to be familiar with are: layoutPriority fixedSize Spacer GeometryReader alignmentGuide PreferenceKey protocol The last two are pretty advanced and obscure mechanisms, but sometimes that’s what’s needed!
Sep ’22