Skip to content

Instantly share code, notes, and snippets.

@takoikatakotako
Created October 24, 2024 01:52
Show Gist options
  • Save takoikatakotako/41958918b251140de24276685314d95d to your computer and use it in GitHub Desktop.
Save takoikatakotako/41958918b251140de24276685314d95d to your computer and use it in GitHub Desktop.
NavigationViewの戻るボタンを非表示にする
import SwiftUI
struct ContentView: View {
let fruits = ["Apple", "Banana", "Orange", "Grape", "Cherry", "Peach"]
var body: some View {
NavigationView {
List(fruits, id: \.self) { fruit in
NavigationLink(destination: SecondView(fruit: fruit)) {
Text(fruit)
}
}
}
}
}
import SwiftUI
struct SecondView: View {
let fruit: String
var body: some View {
Text(fruit)
.navigationBarBackButtonHidden(true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment