Reputation: 105
I get Ambiguous use of method
error. The reason is because I have a project with two targets, and the targets use either of two frameworks that have the same methods but with different theme usages.
Based on the selected target, I wish to import a different framework on the same file. For example:
InitializeViewController.swift
For Theme A
import FrameworkX
For Theme B
import FrameworkY
How do I import either framework based on the selected target to avoid ambiguous error? Or is there another better approach?
Upvotes: 4
Views: 1820
Reputation: 53121
In your target's build settings, Swift Compiler - Custom Flags -> Other Swift Flags, add a flag for one target, say -DTargetX
Then…
#if TargetX
import FrameworkX
#else
import FrameworkY
#endif
Upvotes: 7