Post

Replies

Boosts

Views

Activity

List with selected item in NavigationSplitView with a NavigationStack as detail
I am experiencing issues using NavigationStack inside an NavigationSplitView. Since the NavigationSplitView doesn't support the new NavigationPath, I presumed I need to use the NavigationStack as detail view for the NSV. However, if I use the NavigationStack with NavigationPath and change content from the sidebar, the end result on iPad OS becomes rather weird. It doesn't push the views correctly, and pops before applying the next view. Am I doing something wrong? Or am I using the APIs in an unintended way? This is my code: struct ContentView: View {   @State private var selectedItem: Int?   @State private var navigationPath: NavigationPath = NavigationPath()      var body: some View {     NavigationSplitView {       List(selection: $selectedItem) {         ForEach(0...10, id: \.self) { item in           Label("Item: \(item)", systemImage: "chevron.right").tag(item)         }       }     } detail: {       NavigationStack(path: $navigationPath) {         VStack {           Text("Hello, world!")           Button {             navigationPath.append("next")           } label: {             Text("Next page")           }         }         .navigationDestination(for: String.self, destination: { text in           Text(text)         })         .navigationDestination(for: Int.self) { int in           VStack{             Text("Item: \(int)")                            Button {               navigationPath.append("next")             } label: {               Text("Next page")             }           }         }       }     }.onChange(of: selectedItem) { newValue in       guard let int = newValue else { return }       navigationPath.append(int)       debugPrint("Appended path \(int). Count: \(navigationPath.count)")     }   } } The result I am experience is: Update: Upon further investigation, it seems that this has to do with the $selectingItem binding property, if this is set then it messes up the NavigationStack. For instance, if you change the List in the code above to the following, it works like a charm: List {   ForEach(0...10, id: \.self) { item in     Label("Item: \(item)", systemImage: "chevron.right").onTapGesture {       selectedItem = item     }   } } I've filed FB11165904
1
0
1.8k
Aug ’22
GPX 12.5.1 not showing GPX files
A few of us are having problems with GPX files in Xcode 12.5.1 while having Xcode 13 beta 5 installed. When running our app, the list doesn't show any locations from the GPX files in our project, although they are added and recognised. Xcode 13 does show the GPX files, without any changes to the project nor the GPX files. We've tried removing the Xcode cache using rm -rf ~/Library/Caches/com.apple.dt.Xcode also, just to be sure, we've tried different command line tools... both without success. I'm not sure if this is due to the beta installed, or just a coincidence. Does anybody recognise this problem and was able to fix it? Example Xcode 12.5.1: Example Xcode 13 beta 5:
2
1
1.1k
Sep ’21
Problem building Watch Extension in Xcode 12 beta 3
I have a problem building my project on Xcode 12 beta 3. When I build I get the following error for my Watch Extension: ld: in /Applications/Xcode-beta3.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator7.0.sdk/usr/lib/libWKExtensionMainLegacy.a(WKExtensionMainLegacy.o), building for watchOS Simulator, but linking in object file (/Applications/Xcode-beta3.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator7.0.sdk/usr/lib/libWKExtensionMainLegacy.a(WKExtensionMainLegacy.o)) built for watchOS, for architecture arm64 From what I understand is that it is complaining that the libWKExtensionMainLegacy.a file is build for arm64, not the simulator. I've checked https://developer.apple.com/forums/thread/130684 but didn't really help me. Any suggestions on how to resolve this?
3
0
3k
Jul ’20