Created
June 24, 2024 07:13
-
-
Save 1998code/2a81768cdd67c5535658ff38e12a4052 to your computer and use it in GitHub Desktop.
Picker Demo in .navigationLink Style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.swift | |
// Picker Demo in .navigationLink Style | |
// | |
// Created by Ming on 24/6/2024. | |
// | |
import SwiftUI | |
struct ContentView: View { | |
@State var numberOfPeople = 0 | |
var body: some View { | |
NavigationStack { | |
Form { | |
Section { | |
Picker(selection: $numberOfPeople, label: Text("Number of people")) { | |
ForEach(2..<10, id: \.self) { | |
Text("\($0) people") | |
} | |
}.pickerStyle(.navigationLink) | |
} | |
} | |
.navigationTitle("WeSplit") | |
.navigationBarTitleDisplayMode(.inline) | |
} | |
} | |
} | |
#Preview { | |
ContentView() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment