Reputation: 571
We have created two Targets (Target_One & Target_Two) for same project.
The reason to create two target : we need to upload two apps with same UI but different SDK integration.
As we know, each SDK has their own delegates. So we want to apply delegates specific to the target.
Example: Target_One has a class named MyClass
class MyClass: NSObject, Target1SDKHelperDelegate {
}
In above class, we have implemented Target1SDKHelperDelegate delegate. We are using same class for Target_Two also and we want to use Target2SDKHelperDelegate for Target_Two.
So how we can put two different delegates to for two different targets?
We also know to manage target we should use below code.
#if Target_One
#else
#endif
But anyone tell us how to manage delegate by using above?
We want to do something like :
class MyClass: NSObject
#if Target_One
, Target1SDKHelperDelegate
#else
, Target2SDKHelperDelegate
#endif
{
}
Upvotes: 0
Views: 1428
Reputation: 11
Can try like this code with use typealias:
#if FREE_VERSION
public typealias DELEGATES = UIViewController & AttributeUDBClientMainDelegate & AttributeSubscriptionHelperDelegate
#else
public typealias DELEGATES = UIViewController
#endif
public final class SettingsViewController: DELEGATES {
Upvotes: 1
Reputation: 419
Actually it is pretty simple and direct . Lately I faced the issue cause of size of iPA went too big like 20MB . I disabled not needed features from some targets and had to manage the shared files like Appdelegate when it has references to disabled features files . Solved this by simply duplicating Appdelegate file and put it in a specific paths related to specific targets . Then included each appDelegate file under its target. It worked . The idea is the same like if you have firebase push notifications pLists configuration files for multiple targets OR imageAssets folders. Hope this helps.
Upvotes: 0