Run your SQLite.Swift Apps on Android without any code change

At SCADE, we want to make sure that all your favourite Swift data persistence options are available on both Android and iOS without a need for code changes. This article describes the SQLite.Swift support.
SQLite.Swift is an awesome library to make working with the SQLite database even easier. It provides utility classes to easily implement data persistency on iOS using Swift. Due to the availability of Swift Foundation for Android and static C library linking support thanks to SCADE, SQLite.Swift is now available for Swift for Android as well.
The design goal of the implementation is simple: Run your SQLite.Swift code on Android without any code change. To demonstrate this, we are running the sample code from github https://github.com/stephencelis/SQLite.swift .
1. Add SQLite libraries
The SQLite functionality is implemented as static C libraries that need to be embedded in the app for Android. On iOS, SQLite is part of iOS and doesn’t need to be added. We add the libraries into the lib directory of the newly created project:

2. Add SQLite.Swift package dependency
SQLite.Swift is available as an SPM package. We added support of SPM in SCADE 0.9.8.x and the support is straightforward. Just specify URL, from label and the name of the linked library in the build file of your SCADE project:

3. Copy SQLite.Swift sample code from SQLite.Swift website
Now, to demonstrate the fact that SQLite.Swift runs without any code change, copy the comprehensive example from the SQLite.Swift website (https://github.com/stephencelis/SQLite.swift#usage) into the main page of the app:

4. Run the unmodified code on Android
You can now press the compile button, and the compiled Android app shows up in the Android emulator :-).

Viva Swift!
Your SCADE team
Links
- SCADE SQLite tutorial: https://docs.scade.io/v1.0/docs/data-persistency-with-sqliteswift
- Find the video here https://youtu.be/xBgS5Hv-mGQ