You can leverage all of the iOS functionality and soon all of the Android SDK in your cross platform application. Depending on your mobile os, you use conditional compilation statements to execute code for the specific platform. In below examples, we execute iOS specific functionality. We will extend this chapter with examples of invoking the Android API shortly.
We use Apple Swift compiler conditional compilation statements. A good documentation can be found here [Apple Swift Conditional Compilation Blocks](🔗)
# Checking for the platform
We introduced Android as an additional platform. Here a code snippet to execute code on iOS or Android
# canOpenURL example
In this example, we add conditional code. If we are on iOS, we use _canOpenUrl_ function to check the validity of the URL. The app is simple. Whenever we press the check button, it gets the text value and checks its URL using the platform specific canOpenUrl. Depending on the result, we show a red or green indicator.
We use the foundations URL class. SCADE provides both Swift 3 and the foundation cross platform for Android and Apple. This includes the URL class.
The code for the app looks like this and is hopefully self explanatory.