UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Does the syntax get easier to understand and memorize as the projects go on?

Forums > 100 Days of SwiftUI

I recently finished the 14 basic Swift days and thought I have a good basic understanding of stuff. I started the first project, and while I find it all interesting and cool, it's also terrifying and disheartening seeing all those modules SwiftUI has baked on. I

t's like... i think I understand it when Paul does it, such as locales, keyboards etc.. but then again, how will I ever use this on my own, like bam - this is how you write it down.

I guess it's syntax that's often used across apps so it'll come second nature when used a couple of times?

   

@krepandus shares doubts we've all had before:

I guess it's syntax that's often used across apps so it'll come second nature....

Biscuits ๐Ÿฅฏ ๐Ÿฅ


My grandmother made the fluffiest biscuits. She could grab some flour, a chunk of butter, milk, a dash of salt, a shake of vanilla, and a few other ingredients and make delicious biscuits for 3, 9, or 20 people. Golden crust on the outside, heavenly clouds in the middle. She did this from memory. I'd try the same, and gronk up the ratios. Instead of fluffy biscuits, I'd make runny pancake batter. Or thick hockey pucks as hard as cement.

The difference, of course, was experience. To gain grandma-level ๐Ÿ‘ต๐Ÿฝ experience, I had to make scores of biscuits, often ruining a batter and needing to start over. What helped me gain the experience was a hand written recipe!

I wrote down the measurements and made biscuits for breakfast each morning for weeks. To be honest, I ate scores of awful biscuits. After a while, basic biscuits were easy. And they started to taste great! Then I tried some variations, making numerous notes on the recipe for different textures or flavors. Before long, I didn't need the recipe card. But it was always available for reference.

Playgrounds ๐Ÿ› ๐ŸŽก


I recommend you use playgrounds as your recipe book! It's easy to create multi-page playgrounds in Xcode. I recommend you put a different topic on a new page. Give the page a name, similar to naming a biscuit recipe.

One page could be recipes for sorting arrays.
Another page could be for useful array methods. Create examples and document them for future you.

One page could demonstrate the Picker user interface element. Another page could demonstrate how to implement gradients and drop shadows with a button.

Make lots of notes! Comments are just as important as the sample code! Write lots of comments to yourself! Explain what you're doing and help your future-self understand your code. Future You will be grateful!

Hint: when writing comments, explain the code to yourself using the Rubber Duck Technique ๐Ÿค

Practice ๐Ÿ‘ฉ๐Ÿผโ€๐Ÿณ ๐Ÿ‘จ๐Ÿฟโ€๐Ÿณ


Now you need to practice in the kitchen! Grab a screenshot from a favorite application. Try to duplicate the Notes interface. Open the Contacts application on your iPhone and start entering a new friend. Duplicate that interface in Xcode. If you get stuck on how to add an SF Symbol to a button, before you get frustrated, check your ๐Ÿ“– recipe book. You should have a small, concise recipe for Making a Button with SF Symbols. The rest of the new contacts screen seems to use a Form. Don't remember how to create a view using a Form and Sections? Check your recipes! Sometimes you'll have to create a NEW recipe, but that's how you build experience. Soon you'll have a page in your playgrounds titled Favorite Buttons. You'll reuse that recipe over and over again.

I've shared a few recipes in these forums. Search for >playgrounds< and start adding these to your own playground. To get you started, here are a few that I've written for the forums.

See-> Initializing Structs
See-> Getting a Variable's Type
See-> Fun with Dictionaries
See-> Picker Examples

Keep coding!

2      

@Obelix Thank you for your in-depth answer! I see that I maybe jumped to conclusions too early. Patience is a virtue I've yet to fully master, but I will keep on keeping on.

   

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ โ€“ it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topicโ€ฆ

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.