Hello all,
I am receiving this error “Variable ‘roundedValue’ was never used; consider replacing with ‘_’ or removing it” but feel that I have followed the instructor and can’t understand where this is coming from. Who can help to trouble shoot?
struct ContentView: View {
@State private var alertisVisible: Bool = false
@State private var sliderValue: Double = 50.0
var body: some View {
VStack {
Text(“\nPUT THE BULLSEYE AS CLOSE AS YOU CAN TO”)
.bold()
.multilineTextAlignment(.center)
.lineSpacing(4.0)
.font(.footnote)
.kerning(2.0)
Text(“89”)
.kerning(-1.0)
.font(.largeTitle)
.fontWeight(.black)
HStack {
Text(“1”)
.bold()
Slider(value: $sliderValue, in:1.0…100.0)
Text(“100”)
.bold()
}
Button(“HIT ME”) {
alertisVisible = true
}
.alert(
“Hello there!”,
isPresented: $alertisVisible,
actions: {
Button(“Awesome”) {
print(“Alert Closed”)
}
},
message: {
var roundedValue: Int = Int(sliderValue)
Text(“The slider’s value is (sliderValue), and rounded value is /(roundedValue).”)
}
)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}