Whirlwind is on the lookout for a canonical reply.
I’ve a number of subprojects inside a single Xcode venture, and I have to merge two of them which can be fairly related. These two subprojects share about 80% of their recordsdata, however there are additionally variations within the remaining 20% of the recordsdata. I wish to consolidate these two subprojects into one and reuse the shared recordsdata effectively.
Right here’s what I need assistance with:
Copying Targets: Every venture has a number of targets. What’s one of the best ways to maneuver targets from one subproject to a different inside the similar Xcode venture, together with transferring all construct settings and configurations?
Reusing Shared Information: How can I successfully handle and reuse recordsdata which can be widespread between the 2 subprojects, and deal with the variations within the remaining recordsdata?
Adjusting Construct Settings: What steps ought to I comply with to make sure that the construct settings from the supply subproject are appropriately utilized to the merged subproject?
Additionally I’m not certain what can be a great way to deal with variables that differ per goal. I’ve two recordsdata at present, which can be actually the identical, they only differ by some variable (some setting, that’s outlined per goal.) So I wish to use one file, as an alternative of two and to set that variable appropriately per goal. I’ve two methods in my thoughts. So, the primary manner can be to make use of “flags”:
// SharedFile.swift
#if TARGET_ONE
let variableA = “123”
#elseif TARGET_TWO
let variableA = “345”
#endif
And the opposite manner can be to make use of configuration recordsdata:
// SharedFile.swift
let variableA: String = {
if let path = Bundle.fundamental.path(forResource: “Config”, ofType: “plist”),
let dict = NSDictionary(contentsOfFile: path),
let worth = dict[“variableA”] as? String {
return worth
}
return “default”
}()
I by no means achieved run into these necessities so I’m not certain what’s the option to go, and I’d respect any recommendation about how deal with this complete course of. Thanks upfront in your assist!