This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5993-your-first-ios-and-uikit-app/lessons/2
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5993-your-first-ios-and-uikit-app/lessons/2
Hello Sir ,
I am creating Bulls eye app adding buttons and added piece of code following tutorial in Xcode 11.3 version and I don’t have SE simulator tried in running iPhone 8 simulator but it is not taking landscape mode it is running in only portrait mode and not able see the button control on the simulator. Can you please suggest me what’s needs to do ?
Hi, nice tutorial update…
After revisiting my code, after updating to Xcode 12, I however noticed something when hitting “Hit Me”. The Header changes with whatever score you get, but not the “dismiss” button.
So, here is a suggestion:
return Alert (title: Text(alertTitle().title),
and
dismissButton: .default(Text(alertTitle().dismiss)) {
and then finally:
func alertTitle() → (title: String, dismiss: String) {
let title: String
let dismiss: String
let difference = amountOff()
if difference == 0 {
title = “You nailed it!”
dismiss = “Awesome”
} else if difference < 5 {
title = “You almost had it!”
dismiss = “Great”
} else if difference <= 10 {
title = “Not bad!”
dismiss = “Keep Trying”
} else {
title = “Are you even trying???”
dismiss = “WTF???”
}
return (title, dismiss)
}