Challenge: Start Over | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/18176818-your-first-ios-and-swiftui-app-polishing-the-app/lessons/18
1 Like

I’m confused about what Xcode is doing. As you can see in the screenshot, I have the restart() method in Game.swift… https://snipboard.io/CKwDnZ.jpg However, I’m getting an error that says “Value of type Game has no member restart” in BullseyeTests.swift. See screenshot… https://snipboard.io/HojnXS.jpg
To add to this confusion, the build succeeds even though I have the error. I have never seen Xcode successfully build with a red error. The only time it does not build is when I try to run the test by pressing CMD+U. In any case, the project runs fine and I am able to restart the game.
Note that I ran Product > Clean Build Folder but that did not resolve the issue.

@webdevbyalex Ah it looks like there is a small typo. In Game.swift, the method is named retart but it should be restart. I hope that helps!

My God, I feel so dumb. How did I not see that. Thanx Ray!

I am curious. When I implemented the challenge, I found that there is an onTapGesture method available on the RoundedImageViewStroked view. Is there a difference between the onTapGesture and wrapping the view into a separate button? I used the gesture method and it seemed to work fine in my local testing, but maybe there’s a subtle difference that I couldn’t figure out.

@polkmechanical The onTapGesture method is definitely one way of doing this, but Button also brings some subtle behavior: if you use the Button wrapper, it will automatically change the tint color of the view inside to look like it’s being depressed (while this isn’t done for you with the onTapGesture approach).

That makes sense. I figured there might be subtle differences I wasn’t noticing. Thanks for clarifying.

@rwenderlich Hello, with iOS 13.2, the button code has been changed to this:

Button("Button") {
     Action
}

The steps defined in the tutorial, does not apply to this button and I get error, can you please clarify how it works here?