Add username text field
This commit is contained in:
parent
6a4fa1cfd9
commit
ebe9fe45ac
1 changed files with 12 additions and 3 deletions
|
@ -1,17 +1,26 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct ProfileView: View {
|
struct ProfileView: View {
|
||||||
|
let username: String
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
VStack {
|
||||||
Text("Hello, world!")
|
Text("Hello, world!")
|
||||||
|
}.navigationBarTitle(username + "'s Feed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MainView: View {
|
struct MainView: View {
|
||||||
|
@State private var username: String = ""
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
NavigationLink(destination: ProfileView()) {
|
VStack {
|
||||||
|
TextField("Username", text: $username)
|
||||||
|
NavigationLink(destination: ProfileView(username: username)) {
|
||||||
Text("Show Feed")
|
Text("Show Feed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Reference in a new issue