Hello everyone. I'm getting an error in my code and I don't know why. Can someone explain it to me?
import SwiftUI
struct ContentView: View{
var body: some View{
VStack {
Button {} label: {
Text("Click Me")
}
.buttonStyle(.glass)
.frame(width: 200, height: 200)
}
}
}
The error is as follows: Reference to member 'glass' cannot be resolved without a contextual type
Thanks for your help
What tools are you using here?
I used Xcode 26.0b4 to create a new app project (from the iOS > App template), then replaced its ContentView
with your code, and it compiled just fine.
You tagged your thread with Swift Playground, which makes me think you’re using the Playground app. If so, note that it hasn’t been updated with the iOS 26.0 beta SDK; you won’t be able to use iOS 26-specific features in your playground until it is.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"