When it comes to application development, native is the way to go to ensure high performance. It also yields a better user experience (UX).
The problem is that a native app is built exclusively for a single mobile operating system (OS), meaning it’s “native” only for a particular platform or device. The same code can’t be deployed on different platforms. To make the app work across multiple OSs requires creating it natively for each one. That requires significant development time and greater costs.
That’s all about to change.
This, along with proficiency in modular architecture and the ability to employ some of Apple’s latest developments, enabled ClearScale to become the first organization to build an app that runs on four OSs using practically the same codebase.
ClearScale’s customer, Creative Practice Solutions, wanted to reach its target audience across multiple devices and platforms but at the lowest cost possible. The UX would need to be the same regardless of the device, and it would be essential to keep the hardware features in a parity state across apps.
Until recently, the only option for doing anything similar to this was cross-platform development using frameworks such as Electron, React Native, Flutter, Xamarin, and others. However, cross-platform apps don’t integrate flawlessly with their target OSs. As a result, they may not perform optimally due to inconsistent communication between the non-native code and the device’s native components.
Cross-platform apps also can’t take full advantage of native-only features, so they don’t always provide an optimal UX. For example, when creating with Xamarin, developers need to link and reference code between several operating systems and .NET frameworks. This negatively affects app startup and download times, making the app experience less pleasant for the end user.
There are other disadvantages with the cross-platform frameworks as well. For example, React Native is good for simple apps but isn’t so good for those with many screens, interactions, transitions, or complex animations.
With no bridge between a Flutter app and the device, and because all user interface (UI) components belong to the app directly, Flutter apps end up being large. The average Flutter app is about 4.7 MB compared to an average Android native app that’s around 1 MB.
The ClearScale Solution
While the solution ClearScale devised is proprietary to Creative Practice Solutions, the following provides a brief overview of the approach and some of the main solution components.
To solve the issue of developing native apps that could work across multiple platforms, ClearScale took advantage of several recent developments from Apple. That included the September 2019 release of Catalyst, which makes it easy to take apps developed natively for iOS devices and run them natively on Macs. Catalyst apps are built using the iOS 13 software development kit (SDK), with relatively few changes to the API set.
Catalyst includes the Apple UIKit framework, which provides the required infrastructure for iOS or tvOS apps. UIKit unifies the substrate layer between iOS and macOS so iOS apps can run on the macOS. The apps maintain the same design and functionality as on iOS devices and iPads, but the UX and UI are adapted to match the macOS design patterns.
Apple also split its iOS into iOS 13 for iPhone and iPod Touch and iPadOS for iPad. This allows for enhancements specific to each device, including features that make sense for the iPad’s bigger displays and hardware.
ClearScale’s solution employs a modular architecture. The business logic components (without UI/UX) are separated to the base framework with two targets — UIKit and UIKit-tvOS. AWS SDK was used for the Mac Catalyst and tvOS targets.
The different UI capabilities required augmenting the support of the drop-in AWS authentication. Because AWS provides Cognito Advanced Security features as a compiled library, the library had to be disabled on macOS and tvOS.
The biggest challenge was with the AWS SDK. To properly adapt, it required using preprocessor macros for C/C++/Objective-C code because AWS SDK is written using low-level APIs and pre-Swift Apple language. Linker and build scripts were used to build the app on tvOS in the usual way. The UI/UX logic was divided between UIKit and UIKit-tvOS executables.
To achieve user interaction parity, ClearScale used conditional compilation, which allows the compiler to produce differences in the executable program produced and controlled by parameters that are provided during compilation.
This allowed ClearScale to use code dedicated to the specific platform in the source files for all platforms. Doing so enabled the addition of support for file picker on macOS, and keyboard support for macOS and iPadOS. In the future, this will allow for other enhancements as well, such as adding PencilKit support for iPadOS.
Using this architecture will also eventually allow for providing Apple Watch support. Currently, a different UI engine, WatchKit, is required. However, the business logic created will remain the same, which could save between 70-80% of the time required for the development.
ClearScale is the first company to use this approach to create a single codebase for use in an app that can run natively on four different platforms: iOS, iPadOS, macOS (Catalyst), and tvOS. The code is basically the same. The UX is the same.
The only difference between the apps on each OS is the user interaction: touches for iOS and iPadOS; Siri Remote and Focus Engine for tvOS; and mouse and keyboard for macOS.
In essence, Creative Practice Solutions received four native apps for the price of one. Other benefits resulting from this project include:
- The iOS, iPadOS, and macOS app can be installed from the one file
- New features can be added at any time by parallel development teams
- The future ability to add watchOS as a target platform
Make Your Apps Native and Multi-platform
To learn more about the benefits of multi-platform, native app development, talk to the solution experts at ClearScale. We excel at creating solutions for some of the most complex app development challenges. We’re also your team for all things cloud.
Get in touch today to speak with a cloud expert and discuss how we can help: