Conditionally import a framework (such as Speech) based on iOS Version in Swift?
You need to use
#if canImport(YourFramework)
import YourFramework
#endif
instead of @available now, after setting your framework as optional :-)
You can make the Framework optional (details and image from Ray Wenderlicht):
This, combined with your use of @available, should prevent the system from trying to load it on the devices where it is not available.