I'm going through the tutorial and have copied the code given to me verbatim, but I am still getting the error 'Value of type 'SettingsView' has no member 'tabItem'. Not sure what to do. Code is below.
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
TabView {
ContentView()
.tabItem {
Label("Journal", systemImage: "book")
}
SettingsView()
.tabItem { *error is here - Value of type 'SettingsView' has no member 'tabItem'
Label("Settings", systemImage: "gear")
}
}
}
}
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello, I am going through the swift tutorial and am experiencing an 'expected expression after operator' error in when I am trying to add the favorite button. I'm not quite sure how to fix it.
Below is the code and where the error is.
import SwiftUI
struct LandmarkDetail: View {
@Environment(ModelData.self) var modelData
var landmark: Landmark
var landmarkIndex: Int{
modelData.landmarks.firstIndex(where: { $0.id == landmark.id}) !
} **_expected expression after operator_**
var body: some View {
@Bindable var modelData = modelData
ScrollView {
MapView(coordinate: landmark.locationCoordinates)
.frame(height: 300)
CircleImage(image: landmark.image)
.offset(y:-130)