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

What you learned

Projects 7, 8, and 9 were the first in the series I consider to be “hard”: you had to parse JSON data, you had to create a complex layout for 7 Swifty Words, and you took your first steps towards creating multithreaded code – code that has iOS do more than one thing at a time.

None of those things were easy, but I hope you felt the results were worth the effort. And, as always, don’t worry if you’re not 100% on them just – we’ll be using Codable and GCD more in future projects, so you’ll have ample chance to practice.

  • You’ve now met UITabBarController, which is another core iOS component – you see it in the App Store, Music, iBooks, Health, Activity, and more.
  • Each item on the tab bar is represented by a UITabBarItem that has a title and icon. If you want to use one of Apple’s icons, it means using Apple’s titles too.
  • We used Data to load a URL, with its contentsOf method. That then got fed to JSONDecoder so that we could read it in code.
  • We used WKWebView again, this time to show the petition content in the app. This time, though, we wanted to load our own HTML rather than a web site, so we used the loadHTMLString() method.
  • Rather than connect lots of actions in Interface Builder, you saw how you could write user interfaces in code. This was particularly helpful for the letter buttons of 7 Swifty Words, because we could use a nested loop.
  • In project 8 we used property observers, using didSet. This meant that whenever the score property changed, we automatically updated the scoreLabel to reflect the new score.
  • You learned how to execute code on the main thread and on background threads using DispatchQueue, and also met the performSelector(inBackground:) method, which is the easiest way to run one whole method on a background thread.
  • Finally, you learned several new methods, not least enumerated() for looping through arrays, joined() for bringing an array into a single value, and replacingOccurrences() to change text inside a string.
Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

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

BUY OUR BOOKS
Buy Pro Swift Buy Pro SwiftUI Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let us know!

Average rating: 5.0/5

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.