Multiple Release Environment with Xcode 9 - Swift

Viewed 421

I have finished writing a project and released to AppStore. Now i want to duplicate the project and change Bundle ID, Signing certificates, Splash Screen, the project specific links and images used in Storyboard.

Since the Model classes and business model wont change at all. And instead of copy-paste the project, change on classes and when bug comes up fixing it on both projects, changes will be only on interface and signing stuff on the same project.

Is that possible?

Is there anyway that this can be done?

1 Answers

You should create copy of your target, which will allow you to create a separate app with same project business (code) logic and different Bundle ID, Signing certificates, Splash Screen, the project specific links.

Here are steps to create duplicate target:

  1. Select Your Project Target (Project >> General >> Select Target)
  2. Right Click on Project Target
  3. Select Duplicate (Menu popover will provide your option to create a duplicate target)

enter image description here

  1. Here is duplicate copy of your target, that you can distribute as a New app with same business logic.

enter image description here

Your future updates/changes in code will effect on both target, if your source code file has assigned both targets.

Note: Just make sure, when ever you create a new file (after creating duplicate/multiple target), assign.select both targets to make it effective for both apps.

enter image description here

Look at here, my new file TestFile.swift has (links to) multiple targets.

enter image description here

Now to identify your project target programmatically and differentiate your links:

var API_LINK = ""

if let targetName = NSBundle.mainBundle().infoDictionary?["CFBundleName"] as? String {

    if (targetName == "Test") {

        API_LINK = "http://webservice.Test"

    } else if (targetName == "Test copy") {

        API_LINK = "http://webservice.TestCopy"

    } else {

        print("Something wrong - targetName not found")

    }
}
Related