Hi there,
I am just starting to get into Swift. I have been following Apple's own SwiftUI Tutorials (linked here), but I got stuck at "Section 6 - Set Up Navigation Between List and Detail". In step 6, when I try to "wrap the returned row in a NavigationLink", Xcode tells me:
"Incorrect argument label in call (have '🏷️ ', expected ':destination:')"
"Type '() -> LandmarkDetail' cannot conform to 'StringProtocol'; only struct/enum/class types can conform to protocols"
"Type '() -> LandmarkRow' cannot conform to 'View'; only struct/enum/class types can conform to protocols"
My code is as follows:
import SwiftUI
struct LandmarkList: View {
var body: some View {
NavigationView {
List(landmarks) { landmark in
NavigationLink {
LandmarkDetail()
} label: {
LandmarkRow(landmark: landmark)
}
}
.navigationTitle("Landmarks")
}
}
}
struct LandmarkList_Previews: PreviewProvider {
static var previews: some View {
LandmarkList()
}
}
/*Stuck at Section 6
Set Up Navigation Between List and Detail
*/
May I ask why that happens? In fact I have tried copying the exact code from the Apple's page but it is giving me the same errors. I'm running Xcode V12.0.1 on Catalina. Thank you in advance for any help, and please excuse my ignorance.