TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

What is the best way to update my app to the lates version of iOS

Forums > iOS

I have an app that I wrote 4 years ago and I want to update it to the latest version of iOS. My app is written in iOS 14 and is using SwiftUI and Core Data. I want to switch to Swift Data. Should I just start from scratch and rewite the app entierly or shoud I branch my current repo and change the target to iOS 17 and fix what ever error pops up. This is just an app I use personaly. I never published it to the App Store. I'm getting back into iOS programming and I thought I should update this app to relearn iOS. I haven't touched it since I wrote this app.

I've never updated an iOS app before, but I have updated other apps written in other programming langues and I know how much of a headache that can be.

   

shoud I branch my current repo and change the target to iOS 17 and fix what ever error pops up.

I would do exactly this. The best way, I don't know. But if you're the only one using the app you could rewrite it from scratch regarding SwiftData. You should check if you use any functionality of CoreData which is currently not available in SwiftData.

   

hi,

i agree with @Hatsu. make a new branch.

just a few comments to consider ...

(1) moving from iOS 14 to iOS 17 is not that much of a problem, as far as the OS goes.

(2) you'll probably find some SwiftUI changes will be necessary. there have been several deprecations in the last three years (e.g., NavigationView) as well as newer features (e.g., NavigationSplitView).

(3) moving from Core Data to SwiftData could be, as Apple suggested in their WWDC2022 videos, an easy transition. as usual, though, they showed some simple cases; your mileage will vary.

(4) and a few general comments:

  • do you want to use your existing Core Data SQL data store with SwiftData? that may take a little work to figure out.
  • do you use NSFetchedResultControllers? SwiftData does not currently do those.
  • do you use NSCompoundPredicates? SwiftData does not currently do those. the whole #Predicate thing in SwiftData has been a moving target for anything beyond simple cases.
  • SwiftData makes it easy to add in iCloud mirroring. if you want to use this and you haven't used the cloud already in your app, be aware that there are some things that are not supported in the cloud, such as unique attributes and ordered relationships.
  • all attributes destined for the cloud must either have a default value or be optional. all relationships must be optional.
  • if you have a complicated Core Data model (e.g., entity inheritance or multiple containers), you should wait until the June WWDC event (although some of this is rumored to now be working in iOS 17.4).

hope that helps,

DMG

   

Thanks for the replies. I'm going to branch the repo and start converting it to iOS 17. I believe this will be a better way for me to relearn the iOS.

   

As per my knowledge and experience to update your app to iOS 17 while transitioning from Core Data to Swift Data:

  1. Branch the current repo: Create a new branch in your repository to maintain the existing codebase and work on the update separately.

  2. Change the target to iOS 17: Adjust the project's deployment target to iOS 17 and see what errors appear.

  3. Resolve issues: Address any errors and deprecations that arise due to the target change.

  4. Gradual transition to Swift Data: Begin shifting your data models and storage logic from Core Data to Swift Data incrementally.

  5. Leverage new features: Take advantage of new iOS 17 features and improvements in your app.

  6. Test thoroughly: Ensure your app functions correctly on iOS 17 through testing and debugging.

This approach allows you to update your app efficiently while keeping the original version intact.

   

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 your entire paywall view without any code changes or app updates.

Learn more here

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.