Skip to content

Instantly share code, notes, and snippets.

@1998code
Created June 24, 2024 07:13
Show Gist options
  • Save 1998code/2a81768cdd67c5535658ff38e12a4052 to your computer and use it in GitHub Desktop.
Save 1998code/2a81768cdd67c5535658ff38e12a4052 to your computer and use it in GitHub Desktop.
Picker Demo in .navigationLink Style
//
// 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