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")
}
}
}
}
Hence the reason for visual formatters. Don't use the Decimal type unless you really need to.
var x:Double = 0.94
var result = ""
print(x, terminator: "", to: &result)
print(result) // 0.94
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
}
}
}
You need to store the row selected in a state variable. See the Fruta sample code for SmoothieList.
@State private var selection: String?
...
NavigationLink(tag: some_kind_value_to_tag_each_nav_link_from_list, selection: $selection)
...
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")
}
}
}
}
Hence the reason for visual formatters. Don't use the Decimal type unless you really need to.
var x:Double = 0.94
var result = ""
print(x, terminator: "", to: &result)
print(result) // 0.94
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
}
}
}
You need to store the row selected in a state variable. See the Fruta sample code for SmoothieList.
@State private var selection: String?
...
NavigationLink(tag: some_kind_value_to_tag_each_nav_link_from_list, selection: $selection)
...