My App supports from version iOS 9. One of the frameworks that I am adding Icecream framework to sync realm objects needs iOS 10 or greater.
How to make the import of the framework conditional?
I have tried making the IceCream framework as optional under Linked frameworks and libraries under projects General tab
In Swift 4.1 you can have conditional import using canImport directive, like the one below which I have tried.
#if canImport(IceCream)
import IceCream
#endif
The above import statement still throws a build error: Modules deployment target is iOS10
What configuration am I missing?
you need to include the called functionality of your IceCream framework also with that macro like
#if canImport(IceCream)
let iceCream = IceCream()
let text = iceCream.toString()
#else
// and now?
#endif
And you should think about the else code.
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