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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With