Post

Replies

Boosts

Views

Activity

Cannot infer contextual base in reference to member 'background'
Started following Apple's Develop in Swift tutorials and was met with the error in the title. // ContentView.swift // OnboardingView // // // import SwiftUI extension Color { static var gradientTop = Color("gradientTop") static var gradientBottom = Color("gradientBottom") } let gradientColors: [Color] = [ .gradientTop, .gradientBottom ] struct ContentView: View { var body: some View { .background(Gradient(colors: gradientColors)) TabView { WelcomePage() FeaturesPage() } .tabViewStyle(.page) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } Xcode 13.2.1 used for compatibility reasons.
1
0
496
Apr ’24