|
Hi! I've just finished the Rock Paper Scissors challenge. I feel like I did fairly well, but I would love some feedback to see where I can improve. The most difficult thing for me in this challenge was refactoring my Here's my code, along with a screenshot of the end result:
Thank you for your time! |
|
Darrell asks for feedback, but wisely doesn't ask for answers!
You used strings to represent the three options in your application. What syntax allows you to limit options to only predetermined choices? How can you leverage this to encapsulate game logic into usable methods? See -> Day 3: Complex Data Structures Here's a short bit I wrote for another programmer. It includes hints that may help guide you. See -> Rock, Paper, Scissors Help |
|
Darrell asks for feedback, but wisely doesn't ask for answers!
This is one of my peeves; others disagree. ContentViewIn decades of coding courses and C+ Programming for Dummies type books, function names were often given the generic name When you create a new SwiftUI view, XCode gives the view a nonsense name: @twoStraws and most all other SwiftUI content providers in YouTube land will express the need for descriptive variable names. They'll note how important it is to use camelCase, or to capitalize the names of Structs and Classes. Indeed, when creating other views in a project, they're very careful to give the new views a meaningful name! Yet, they'll often leave the first view named Well, you asked for feedback and ways to improve. Here's my personal feedback. As soon as you create a new SwiftUI View, change the name from ContentView to something meaningful in your application. For example, in your game, the main focus of your applicaiton is the Factor UI into Smaller ChunksHere's another place where you can start to improve your code.
Reusable Lego BricksI think of this as building your own Lego pieces. After building a few, you can snap your Then in your
This cleans up your |
|
Hi Obelix! Thank you so much for your great advice. I will try to implement it into the project in the coming days and report back here again. :) |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.