I'm new to swiftUI and just trying to figure out the basics. I'm simply trying to create a new view and a button that will move to it.
When I use the code below, an error appears: "Use of unresolved identifier 'NavigationButton'" despite that being generated by Xcode.
import SwiftUI
struct HomeView: View {
var body: some View{
NavigationView {
NavigationButton(destination: NextView()) {
Text("Navigate 1")}
}
}
}
NavigationButton
changed to NavigationLink
for a while now. So replace it and use it.
NavigationLink
replace NavigationButton
, The code below is update for WWDC 2019 Introducing SwiftUI: Building Your First App
struct RoomCell: View {
let room: Room
var body: some View {
NavigationLink(destination: RoomDetail(room: room)) {
Image(room.thumbnailName)
.cornerRadius(8)
VStack(alignment: .leading) {
Text(room.name)
Text("\(room.capacity) people")
.font(.subheadline)
.foregroundColor(.secondary)
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With