Post

Replies

Boosts

Views

Activity

Reply to iOS15 NavigationView lost the state after putting app in background and bring it back
Move the parent NavigationView from LocalNotificationDemoView to the MainView tabs. There is no need for the .navigationViewStyle(.stack) modifier. struct LocalNotificationDemoView: View {     var body: some View {         VStack {             MainView()         }     } } struct MainView: View {     var body: some View {         TabView {             NavigationView {                 Tab1()             } .tabItem {                 Text("Tab1")             }             NavigationView {                 Tab2()             }.tabItem {                 Text("Tab2")             }         }     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to How to know the active & foreground scene in multi-windows supported iPadOS app?
Traverse the scene hierarchy for an active or main window something like below. Might need tweaking. extension UIWindow { public static var keyWindow: UIWindow ? { if #available(iOS 13.0, *) { return UIApplication.shared.connectedScenes .compactMap { $0 as? UIWindowScene } .first?.windows.filter { $0.isKeyWindow }.first } else { return UIApplication.shared.keyWindow } } }
Topic: App & System Services SubTopic: Hardware Tags:
Nov ’21