Post

Replies

Boosts

Views

Activity

iOS 26: Navigation bar unexpectedly switches to Light appearance during navigation in Dark Mode
Summary On iOS 26, the navigation bar unexpectedly switches to a Light appearance during/after a view transition while the device/app is in Dark Mode. This seems correlated with applying listStyle(.plain) to a List. Removing .plain prevents the issue, but my app’s layout requires it. Sample code: import SwiftUI @main struct iOS26NavigationTitleSampleApp: App { var body: some Scene { WindowGroup { NavigationStack { ContentView() .navigationTitle("Root") .navigationBarTitleDisplayMode(.inline) } } } } struct ContentView: View { var body: some View { VStack { NavigationLink { ListView() } label: { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } } } .padding() .toolbar { ToolbarItemGroup(placement: .navigation) { Button("Test") { } Button("Test2") { } } } } } struct ListView: View { var items: [Int] = Array(0..<100) var body: some View { List { ForEach(items.indices, id: \.self) { idx in cell(items[idx]) } } .listStyle(.plain) .toolbar { ToolbarItemGroup(placement: .navigation) { Button("Test") { } Button("Test2") { } } } .navigationTitle("TTT") } private func cell(_ item: Int) -> some View { Text("\(item)") } } Steps to Reproduce: Set the device to Dark Mode. Launch the sample app. → The root view’s navigation bar is in Dark appearance (as expected). Tap “Hello World” to navigate. → On the destination view, the navigation bar becomes Light. Navigate back to the root view. → The root view’s navigation bar now also remains Light. Expected Result The navigation bar should consistently retain the Dark appearance throughout navigation. Notes Removing listStyle(.plain) stops the issue (navigation bar stays Dark). Simulator: Could not reproduce on iOS Simulator. Devices: Reproducible on physical device. Environment Device: iPhone 15 Plus OS: iOS 26 (23A341) Xcode: 26.0 (17A324)
5
0
414
Oct ’25
iOS18 beta2 NavigationStack: Tapping Back from a lower-level View returns to the Root View / No transition animation
This is a report of an issue that appears to be a regression regarding NavigationStack. While investigating another issue [iOS18 beta2: NavigationStack, Views Being Popped Automatically] , I encountered this separate issue and wanted to share it. In a NavigationStack with three levels: RootView - ContentView - SubView, tapping the Back button from the SubView returned to the RootView instead of the ContentView. This issue is similar to one that I previously posted regarding iOS16.0 beta. https://developer.apple.com/forums/thread/715970 Additionally, there is no transition animation when moving from ContentView to SubView. The reproduction code is as follows: import SwiftUI struct RootView2: View { @State var kind: Kind = .a @State var vals: [Selection] = { return (1...5).map { Selection(num: $0) } }() @State var selection: Selection? var body: some View { if #available(iOS 16.0, *) { NavigationStack { NavigationLink { ContentView2(vals: $vals, selection: $selection) } label: { Text("album") } .navigationDestination(isPresented: .init(get: { return selection != nil }, set: { newValue in if !newValue { selection = nil } }), destination: { if let selection { SubView2(kind: .a, selection: selection) } }) } } else { EmptyView() } } } struct ContentView2: View { @Binding var vals: [Selection] @Binding var selection: Selection? @Environment(\.dismiss) private var dismiss var body: some View { list .onChange(of: self.selection) { newValue in print("changed: \(String(describing: newValue?.num))") } } @ViewBuilder private var list: some View { if #available(iOS 16.0, *) { List(selection: $selection) { ForEach(self.vals) { val in NavigationLink(value: val) { Text("\(String(describing: val))") } } } } } } // struct SubView2: View { let kind: Kind let selection: Selection var body: some View { Text("Content. \(kind): \(selection)") } }
6
1
1k
Jul ’24
App Freezes with AVPlayer Inside NavigationStack on iOS 17.2 beta
I've encountered a critical issue while testing my app, which is available on the App Store, on the iOS 17.2 beta (iPhone SE simulator). The app freezes and becomes unresponsive. Currently, I haven't found a workaround, which means my app is completely non-functional and untestable on iOS 17.2 beta. The app supports iOS 15.2 and later versions, and it has been working fine from iOS 15.2 through iOS 17.1. The problem only occurs on the iOS 17.2 beta. I have been able to reproduce the issue with the sample code provided below. ■ Test Environment: macOS: 14.0 (23A344) Xcode Version: 15.1 beta (15C5042i) iPhone SE 3rd generation (simulator): iOS 17.2 (21C5029e) ■ Steps to Reproduce: Prerequisites: Prepare an audio file, such as an m4a or mp3, and add it to the Bundle Resources. 1 Launch the sample code provided below. 2 Tap on any row's NavigationLink. After tapping, when the program attempts to access the AVPlayer, the following log is displayed in Xcode: CA_UISoundClient.cpp:1127 Device = 0 HALPlugInManagement.cpp:396 HALPlugInManagement::RegisterPlugIns: loading in-process plug-ins AddInstanceForFactory: No factory registered for id <CFUUID 0x600000285600> F8BB1C28-BAE8-11D6-9C31-00039315CD46 CA_UISoundClient.cpp:1203 renderer = 0x600000011f90, synchronizer: 0x0, repeat: 0, vol: 1.00 3 Tap the Navigation's Back button at the top left. Depending on the timing, there may be no response when pressing the button (screen). Approximately 15 seconds later, the following log is displayed, and the screen becomes responsive again as it returns to the previous view. AQMEIO.cpp:198 timed out after 15.000s (0 0); suspension count=0 (IOSuspensions: ) MEDeviceStreamClient.cpp:467 AQME Default-InputOutput: client stopping after failed start: <CA_UISoundClientBase@0x104015d00>; running count now 0 CA_UISoundClient.cpp:293 CA_UISoundClientBase::StartPlaying: AddRunningClient failed (status = -66681). changing items while animating can result in a corrupted navigation bar 4 If the issue does not reproduce, quit the app and then return to step 1. In the sample code, whether the issue occurs or not may depend on the timing of screen transitions, scrolling, and tapping. (The issue might occur with a high probability if you tap 'back' during a screen transition animation.) On the production app in question, the issue occurs 100% of the time. ■ Sample code import SwiftUI import AVFoundation @main struct iOSAppHangSampleApp: App { @StateObject var model = ContentModel() var body: some Scene { WindowGroup { if #available(iOS 17, *) { NavigationStack { ContentView() .environmentObject(model) } } else { NavigationView { ContentViewIOS15() .environmentObject(model) }.navigationViewStyle(.stack) } } } } @MainActor class ContentModel: ObservableObject { private let player = AVPlayer() @Published var playbackDuration: TimeInterval = .zero func load() { let url = Bundle.main.url(forResource: "YourAudioFilename", withExtension: "m4a")! // Change to your audio. let avassetURL = AVURLAsset(url: url, options: [AVURLAssetPreferPreciseDurationAndTimingKey: true]) let avPlayerItem = AVPlayerItem(asset: avassetURL) self.player.replaceCurrentItem(with: avPlayerItem) self.playbackDuration = avPlayerItem.asset.duration.seconds } } @available(iOS 17, *) struct ContentView: View { @EnvironmentObject private var model: ContentModel private let urls: [URL] = { (0..<50).map { URL(fileURLWithPath: "\($0)")} }() @State private var selected: Int? var body: some View { List(selection: $selected) { ForEach(urls.indices, id: \.self) { idx in let _ = urls[idx] NavigationLink(value: idx) { Text("\(idx)") } } } .navigationDestination(item: $selected) { idx in Content3View() .environmentObject(model) } } } @available(iOS 15, *) struct ContentViewIOS15: View { @EnvironmentObject var model: ContentModel let urls: [URL] = { (0..<50).map { URL(fileURLWithPath: "\($0)")} }() @State var selected: Int? var body: some View { List() { ForEach(urls.indices, id: \.self) { idx in let _ = urls[idx] NavigationLink(tag: idx, selection: $selected) { if selected == idx { Content3View() .environmentObject(model) } } label: { Text("\(idx)") } } } } } struct Content3View: View { @EnvironmentObject private var model: ContentModel var body: some View { Text("duration: \(model.playbackDuration)") .onAppear() { model.load() } } } ■ Investigation The sample code has been tested on the iPhone 17.0 simulator, 15.2 simulator, and an iPhone 17.1 real device, but the issue only appears on the 17.2 beta. Also, when replacing NavigationStack with NavigationView in the sample code, the issue does not seem to occur on iOS 17.2. I'm not sure about the relationship between the back navigation and toolbar inside NavigationStack, but it might be related to the following content in the iOS 17.2 Release Notes. Resolved Issues * Fixed: Resolved a possible Swift access conflict crash that could occur with toolbar items. (113992797) This issue also brings to mind the randomness associated with NavigationView / NavigationStack that I've observed. iOS 16.4 NavigationStack Behavior Unstable https://developer.apple.com/forums/thread/727282 SwiftUI NavigationView pops back when updating observableObject https://developers.apple.com/forums/thread/693137 ■ if anyone has found a workaround, please let me know. I have not been able to confirm whether this issue occurs only on the Simulator, but it is preventing me from continuing to test on iOS 17.2 beta since the app is completely non-functional. If this is an issue with iOS 17.2 beta, I hope for a resolution before the official release of iOS 17.2.
7
1
4.0k
Feb ’24
iOS 16.4 NavigationStack Behavior Unstable
I've tested the behavior of NavigationStack in iOS 16.4 and found that it doesn't work in my already published app. Of course, my app works perfectly fine with the NavigationStack in iOS 16 to iOS 16.3. I'm not sure about the cause, but when tapping on a NavigationLink in a very large and complex navigation hierarchy, the corresponding navigationDestination doesn't transition the screen and instead gets caught in an infinite loop. Has anyone else experienced similar issues? I'd like to prepare a sample program to reproduce the issue, but it doesn't occur in simple view hierarchies, so I haven't been able to prepare one yet. Although the release notes for iOS 16.4 mention changes related to the performance of the NavigationStack, I suspect that some instability has been introduced. This behavior reminds me of the unintended automatic pop issue in the NavigationView of iOS 15. In the iOS 16.4 environment, I am planning to revert to using NaviagtionView. Once I have prepared a sample program to reproduce the issue, I will update again. There are bugs in NaviagtionView as well, but in the iOS 16.4 environment, I am temporarily planning to revert to using it. Once I have prepared a sample program to reproduce the issue, I will update again.
9
10
5.2k
Oct ’23
iOS18 beta2: NavigationStack, Views Being Popped Automatically
This is a report of an issue that appears to be a regression regarding NavigationStack. I have been aware of an issue where views are being automatically popped within NavigationView / NavigationStack since iOS 15, and it seems to be reoccurring in iOS 18.0 beta2. Below is the reproducible code. Additionally, in my environment, this problem does not occur iOS 18 simulator, but it does happen on an iPhone XS Max(real device) with iOS 18 beta 2. Environment: Xcode: Version 16.0 beta (16A5171c) iOS: 18.0 (22A5297f) iPhone: XS Max (real device) import SwiftUI @main struct iOS16_4NavigationSample2App: App { var body: some Scene { WindowGroup { NavigationStack { NavigationLink { ContentView() } label: { Text("Content") } } } } } enum Kind { case none, a, b, c } struct Value: Hashable, Identifiable { let id: UUID = UUID() var num: Int } @MainActor class ContentModel: ObservableObject { @Published var kind: Kind = .a @Published var vals: [Value] = { return (1...5).map { Value(num: $0) } }() init() {} } struct ContentView: View { @StateObject private var model = ContentModel() @State private var selectedData: Value? @State private var isShowingSubView = false @Environment(\.dismiss) private var dismiss init() { } var body: some View { if #available(iOS 16.0, *) { List(selection: $selectedData) { ForEach(model.vals) { val in NavigationLink(value: val) { Text("\(val.num)") } } } .navigationDestination(isPresented: .init(get: { selectedData != nil }, set: { newValue in if !newValue && selectedData != nil { selectedData = nil } }), destination: { SubView(kind: model.kind) }) } } } struct SubView: View { init(kind: Kind) { print("init(kind:)") } init() { print("init") } var body: some View { Text("Content") } } This code was shared in a different issue [iOS 16.4 NavigationStack Behavior Unstable].
10
2
2.0k
Aug ’24