GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

SwiftData: Wrap up

Paul Hudson    @twostraws   

Although we've only really scratched the surface of what SwiftData can do, you’ve still seen how it can add, delete, sort, filter, and more, all with relatively simple code. Yes, a few parts are a little murky in Swift – #Predicate, for example, can take some getting used to – but as long as you're careful you should be fine.

Perhaps the most important thing about SwiftData is that it’s guaranteed to be there for all apps, on all of Apple’s platforms. This means you can use it regardless of your needs: maybe it’s for saving important data, maybe it’s just a cache of content you downloaded; it doesn’t matter, because SwiftData will do a great job of managing it for you.

Review what you learned

Anyone can sit through a tutorial, but it takes actual work to remember what was taught. It’s my job to make sure you take as much from these tutorials as possible, so I’ve prepared a short review to help you check your learning.

Click here to review what you learned in this project.

Challenge

One of the best ways to learn is to write your own code as often as possible, so here are three ways you should try extending this app to make sure you fully understand what’s going on.

All three of these challenges relate to you upgrade project 7, iExpense:

  1. Start by upgrading it to use SwiftData.
  2. Add a customizable sort order option: by name or by amount.
  3. Add a filter option to show all expenses, just personal expenses, or just business expenses.

Hacking with Swift+ subscribers can get a complete video solution for this checkpoint here: Solution to SwiftData. If you don’t already subscribe, you can start a free trial today.

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure and A/B test your entire paywall UI without any code changes or app updates.

Learn more here

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.