Fusion

alt_text

What is Fusion?

SCADE enables the iOS developer to use the same Swift codebase to target Android apps. There is no need to learn Java/Kotlin and Android SDK for Swift developers who are using SCADE IDE to build apps.

Recently, the SCADE team has gone open-source with their breakthrough technology called Fusion libraries. Fusion enables us to invoke the Android APIs using the SCADE Fusion SDK. The benefit is we don’t have to bother about setting up the Android platform-specific stuff in the gradle or anywhere. Even iOS-specific settings are very easy and no further prerequisite is required for the same.

Currently, Fusion SDK provides easy integrations for the Geolocation, Bluetooth, NFC, and Media Player, and many more Fusion libraries are in development by the SCADE developers.

Fusion Architecture

Fusion generates Swift Android API that maps to the Java Android API. So for each Swift method you call for iOS, SCADE automatically calls the mapped Android method when it is run on the Android platform. The following diagram depicts how the Fusion libraries are built on top of the Swift iOS and Java Android APIs.

alt_text

Swift-android is the open-source repository where we have generated Swift APIs and methods for the Android SDK. You can easily use Swift Package Manager to integrate swift-android and call Android methods accordingly.
https://github.com/scade-platform/swift-android

Add dependency in Package.swift

dependencies: [
        .package(name: "Android", url: "https://github.com/scade-platform/swift-android.git",.branch("android/24")) 
],

Import Android Libraries

import Java
import Android
import AndroidOS
import AndroidApp
import AndroidContent
import AndroidNFC

Benefits of using Fusion

  • The APIs are automatically generated using our Fusion Generator
  • No waiting time. Fusion Swift Android APIs are available when the Android Java API is available. You can use the feature right away
  • Availability for multiple versions of the Android APIs. Thanks to SPM, you can link against different versions of Android API, depending on your requirements.

How Fusion generates Android API

alt_text

Fusion generator is present in the SCADE editor which analyzes the Android Java API first and then from the swift-android repository, generates the corresponding mapped Swift methods for the Android API.
SCADE editor provides the option to generate the Fusion proxies while creating Fusion libraries. You can access the option, Tools -> Fusion -> Generate Proxies.

alt_text

Fusion Libraries List

S.No Library Name Repository Description
1 FusionLocation https://github.com/scade-platform/FusionLocation Android & iOS Geolocation impl
2 FusionNFC https://github.com/scade-platform/FusionNFC NFC read/write impl for iOS and Android
3 FusionMedia https://github.com/scade-platform/FusionMedia Media player for the iOS and Android platform
4 FusionBluetooth https://github.com/scade-platform/FusionBluetooth Bluetooth impl for iOS and Android
5 FusionLocalAuth https://github.com/scade-platform/FusionLocalAuth Local authentication using biometrics for iOS and Android
6 FusionCamera https://github.com/scade-platform/FusionCamera QR code detection using Camera for iOS and Android
7 FusionUtil In Progress ( https://github.com/scade-platform/FusionUtils ) Utility methods like share content to other apps, open an external URL, open email/phone/SMS and other utility methods.
8 FusionSharedPreferences In Progress ( https://github.com/scade-platform/FusionSharedPreferences ) How to use UserDefaults in iOS and SharedPreferences in Android using Swift
9 FusionPayments In Progress ( https://github.com/scade-platform/FusionPayments ) Cross-Platform Swift library to integrate Apple-Pay & Google-Pay

Contributing

We welcome contributions from the community! If you're passionate about Swift development and cross-platform apps, consider contributing to Fusion. You can contribute by:

  • Reporting issues 🐛
  • Enhancing documentation 📖
  • Submitting pull requests 🛠️
  • Sharing your experiences and insights 💡