The SCADE project structure is based on the SWIFT SPM structure
|.build||The build folder. The compiler stores compiled artifacts in here (APK/IPA files are not stored here)||Developer may ignore this folder for most of the time. Clean command deletes the folder's content|
|Assets||Location for assets such as images and media files used by the application||As a developer, this is the equivalent to the iOS assets folder. Feel free to create subdirectories such as images in here.|
|Products||The compiler stores the created IPA and APK files in here||Use this directory to access the target binaries|
|Sources||In this folder, all the app's sources are stored. The Sources folder contains the root folder HelloWorld and all settings files.|
|Sources/build.yaml||Settings file for Android and iOS specific settings.||The developer defines resources, permissions and other iOS and Android related settings here (Dependencies are not store here anymore)|
|Sources/Package.swift||Our regular SPM Package.swift file to define the project structure as well as dependencies to other projects||The developer stores dependencies in here.|
|Sources/Extensions/Pages||SCADE is using this subfolder to store code that has been generated by the IDE. Changes made through the page builder will result in code changes in this directory.||The files are all read only. The developer should not try to modify files.|
SPM Package manager
SCADE is using SPM heavily and uses the latest SPM features of Swift 5.3. We believe SPM is the future of iOS / Swift development and SPM is therefore our our strategic package manager in SCADE for the current future
If you want to brush up on SPM, find articles on SPM here
If you reference the file directory structure in code, always assume HelloWorld as your home. That means to access an image dog.jpg in the asset folder, you would use Assets/dog.jpg as the path
The start.swift file contains the swift code that is executed when the application is started.
The build file contains important information that is used during the build process:
- the private keys to sign the application when building for iOS
- the location of the icons to be used when building an application
See details here The Build File
The binaries for your iOS app can be exported with two different methods
- ad-hoc method is used for using app on local device
- app-store method is used to upload app in Apple App store
Different export methods require different certificates and provision profiles -
- app-store method needs certificate and provision profile generated for app store
- for testing on local device, ad-hoc certificate and provision profile is needed
Don't forget to install certificate and provision profile to keychain on your computer.
To build for iOS, the most important prerequisite is that you provided the necessary keys for iOS code signing:
For reference, you find the build file description here Build File
- Check that the provision-profile attribute has been set
- Check that the certificate attribute has been set
Your build file should look something like this
iOS Code Signing - Provision Profile and certificate
At this point, we assume that you are familiar with code signing on iOS and you have developed your first iOS app before.
In case this is not true, and you are not familiar with this process, we would recommend to educate yourself by reading some article on this topic. Explaining how iOS code signing works is out of scope of this tutorial, here a list of recommended articles
In order to specify the app's icon, you need to specify different png files in different resolutions. Here our example from the HelloWorld app
To compile to IPA binary, please select Create IPA in the drop down target selector.
You now can use Command + B or the play button to start the compilation and IPA creation process.
The entire .ipa file is built and during compilation, you see the output in the console. You should finally see:
The iOS app has been created and is available for upload in the products directory.
To build an Android app, make sure SDK and NDK are configured as described here
- Choose the target you want to build. Your options are
- ARM 32bit
- ARM 64bit
- x86 32bit
- x86 64bit
- Press the run button to start the compile process
- It will take a few seconds before the console output starts. The initial compilation takes about ~ 30 seconds depending on project size, later runs are faster. The entire .apk file is built and during compilation, you see the output in the console. You should finally see:
- The Android app has been created and is available for upload in the products directory.
The binaries in Android can be released in Debug or Release mode. To upload in Google App store, please use Release mode. To include debugging information, please use Debug mode. The binary compiled in Debug mode will be a couple of MB larger.
The steps to set the release mode are simple
- Specify the build-type in SCADE project build file
- Create a keystore file that contains the key
- Create a keystore properties file that contains the location of the keystore file
- Specify the location of the keystore properties file in the SCADE project build file
To set the mode, open the build file and change the build-Type setting to either Debug or Release.
Next, create the keystore file. The keystore file contains the keys. Use the keytool tools to create the file and make sure its location is set correctly in the keystore.properties file.
keytool -genkey -v -keystore <name of keystore file> -alias <keyname> -keyalg RSA -keysize 2048 -validity 10000
Here an example
Create a text file and call it keystore.properties. Add the following content. Make sure the storeFile entry points to the keystore file you created.
storePassword=MyPassword keyPassword=MyPassword keyAlias=MyPassword storeFile=/<locationToFile>/<keystore_file_name>
Set the location of the keystore.properties file in the keyStoreProperties field in the build file. Use Command + F to search for keyStoreProperties and set the path to reflect the location of the keystore.properties file you just created:
There are 2 ways to set Android APK version:
- Set the version of APK in the versionName and versionCode fields in the build file
- Create Android Manifest with correct APK version and set the path to the manifest in the build file
Look at an example of Android Manifest along this path:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="@[email protected]" android:versionCode="@[email protected]" android:versionName="@[email protected]" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.INTERNET" /> @[email protected] <uses-feature android:glEsVersion="0x00020000"/> <application android:name="@[email protected]" android:allowBackup="false" android:icon="@drawable/ic_launcher" android:label="@[email protected]" android:theme="@android:style/Theme.Black.NoTitleBar"> <activity android:name="@[email protected]" android:label="@[email protected]" android:windowSoftInputMode="adjustResize|stateHidden"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="com.google.android.geo.API_KEY" android:value="@[email protected]"/> </application> </manifest>
Hi, we will add this to the IDE shortly, but to upload the apk to your Android, the easiest way currently is to use the adb tool
- Make sure your Android device is connected via USB cable
- Make sure developer mode is enabled
- Execute the following command adb install
- To get the file name and path, click on the apk file and use right click, and Properties
- Copy the file and path name and paste it into a console window
- The app is now successfully uploaded to Android !!!
Updated over 1 year ago