So when I navigate to Settings it shows a blue Back button. But when I swipe over to go back instead of pressing it. the button wiggles all over the place.
In the iPhone settings app the back button stays in place and slowly fades based on how much I swipe. How can I do that?
also how can I rename it and change the color?
import SwiftUI
enum AppView {
case inventory
case settings
}
struct InventoryView: View {
func navigateToSettings() {
navigationPath = NavigationPath([AppView.settings])
}
var body: some View {
NavigationStack(path: $navigationPath) {
ZStack {
Image("pic1")
.resizable()
.aspectRatio(contentMode: .fill)
.edgesIgnoringSafeArea(.all)
ScrollView {
// Content
.navigationDestination(for: AppView.self) { view in
switch view {
case .inventory:
InventoryView()
case .settings:
SettingsView()
}
}
}
}
import SwiftUI
enum ActiveSheet: Identifiable {
case option 1
case option 2
var id: Int {
hashValue
}
}
struct SettingsView: View {
@State private var activeSheet: ActiveSheet?
var body: some View {
ZStack {
Image("pic1")
.resizable()
.aspectRatio(contentMode: .fill)
.edgesIgnoringSafeArea(.all)
ScrollView {
// Content
.sheet(item: $activeSheet) { item in
switch item {
case .Option 1:
aView()
case .Option 2:
aView()
}
}