Reputation: 5729
I am working on version 2 of an iOS app. Since I am rewriting it in Swift, I started a new Xcode project. Even though the target names are the same, I get two different apps on my device or simulator, so they don't share data and preferences, etc.
Is it possible to have two different projects share the same target? Or should I brute-force replace everything (after a triple backup :) in the original project folder?
Upvotes: 0
Views: 1500
Reputation: 5729
I spend a couple of days and many tries to get this to work, and am outlining below the steps I took. Hopefully this can be useful to others as well.
Background: To learn Swift and also modernize my app, I decided to completely re-write it, using all the goodies of Swift and the newer iOS APIs. Instead of slowly converting one class from Objective C to Swift, as it is described in many tutorials, I just started from scratch. So I made a new project, with the same name of the target, added some basic functionality, and ran it on the simulator. To my surprise, or maybe not, a new app was created, so I had two apps, one written in Objective C, and the new one in Swift. Since my app uses Core Data, they need to be the same, otherwise the user will lose all his/her data when upgrading. So with a lot of trial and error I was finally able to get this to work, here are the steps I used:
Disclaimer: use at your own risk - make sure to have backups so you can always revert.
Optional if you want to have two different projects:
Upvotes: 0