Post

Replies

Boosts

Views

Activity

Reply to Reset NavigationStack when changing selection of NavigationSplitView
[quote='741498022, Frameworks Engineer, /thread/722924?answerId=741498022#741498022'] When selection changes in the sidebar, the navigation system pops value-based links off the stack. [/quote] I think I'm seeing this in my macOS Swift app but in my case it's not the behavior I want. I have navigation links in the sidebar and various views in the detail view. But I want to preserve the state of each detail view so that when the user navigates back to a particular view the navigation path and scroll state is preserved. But the system seems to be resetting the state of each detail view even if I control the navigation paths myself. Is there a way to disable this behavior?
Jun ’24
Reply to Preserving navigation state in NavigationSplitView detail view.
In case anybody else is struggling with this, the solution I finally found that works is like this. Basically not to use a selectable list as suggested above, and use willSet and didSet on the selected item to update the path. Observable class NavigationModel { private var navigationPaths = [RootSection: NavigationPath]() var path = NavigationPath() var selectedSection: RootSection? = RootSection.home { willSet { if let selectedSection { navigationPaths[selectedSection] = path } } didSet { if let selectedSection, let newPath = navigationPaths[selectedSection] { path = newPath } } } init(sections: [RootSection]) { for section in sections { navigationPaths[section] = NavigationPath() } } func selectSection(_ section: RootSection?) { if let section, selectedSection == section { navigationPaths[section] = NavigationPath() } else { selectedSection = section } } }
Jun ’24
Reply to MusicKit Artwork url
I'm seeing something similar here. If I use ArtworkImage the image loads fine but if I try to load it via URLSession I get a bunch of errors like this: [ICUserIdentityStore] Failed to load properties for identity <ICUserIdentity 0x301b99b00: [Active Account: <unresolved>]>. err=Error Domain=ICError Code=-7013 "Client is not entitled to access account store" UserInfo={NSDebugDescription=Client is not entitled to access account store}
1w
Reply to MusicKit UPCs changing and handling that
I'd like to hear what the recommended approach is here too. I've discovered that the id for an album is not a reliable handle for an Album because it can be different on two different devices even if referencing the same Album in the library. But a user's library might contain content they've added themselves so UPC also doesn't seem like a real solution.
1w