Your First iOS and SwiftUI App · Challenge: Starting Over |

This is a companion discussion topic for the original entry at


Question regarding this “Start Over” Challenge. The way I solved it was by entering the following code in my button action pasted below:

indent preformatted text by 4 spaces

// start over button
Button(action: {
print(“Start over button was hit”)
self.startOver = true
self.score = 0
self.round = 1 = Int.random(in:1…100)
self.sliderValue = 50.0


The app worked and I saved myself from writing a function, is this ok? Or not best practice?

@divdoge Thank you for sharing your solution - much appreciated!