Skip to Main Content
Resource Hub

How to Learn Cross-Platform Mobile Tools

By Ethan Campbell

Step 1: Learn Native


At Aptera, one of the expectations we place on our mobile technologists is to constantly evaluate cross-platform tools like React Native, Xamarin, and NativeScript. We vet how easy they are to use, platform capabilities, tool stability (or lack thereof), platform viability (or decay i.e. Cordova), as well as platform features. The purpose of all this is to determine how viable the tool is for saving development costs while delivering a first-class design and user experience. It was through this process that we had the epiphany that leveraging a cross-platform tool doesn’t absolve a developer from learning native iOS and/or Android. In fact, learning those first will actually increase your productivity with the cross-platform tool sets and save yourself from pitfalls you may otherwise not know existed.

It may help to compare having an understanding of the native platforms to knowing how to cook. Simply understanding the cross-platform tools is roughly equivalent to knowing how to “assemble” a meal. In other words, you can boil the box of noodles, drain, then add a jar of tomato sauce and boom, you have a quick dinner. Fully understanding the native mobile platforms would then be the equivalent of a culinary school-level knowledge of cooking. If you have the time and desire, you can fully leverage all the tools in the kitchen to make the tomato sauce and noodles from scratch. It may take a bit longer, but the presentation and taste will be a much bigger hit with your date. Or, maybe you use the boxed noodles and jar sauce, but leverage your knowledge of cooking and dress it up by integrating some white wine and garlic. The point is, your understanding allows you to do more, even with simpler “components.”

Additionally, your cooking knowledge translates from kitchen to kitchen, just as native knowledge translates from say, Xamarin to ReactNative. Just as those platforms have different project organization, each kitchen may have different locations for utensils, pots, and pans. Just as different kitchens leverage gas or electric appliances, different cross-platform tools use different development paradigms. The point is, once you get acclimated to the different environment and the nuances of the tools, you can still win your office’s chili cook-off in any kitchen. So, with that said, let’s go through a few examples of why learning how to “cook” natively, can help you fully leverage the cross-platform “kitchen” of your choice. 


Platform-Specific APIs and Architectural Patterns 


When using a cross-platform tool to create iOS and Android screens, the controls you create are actually abstract controls which the cross-platform tools will map to the appropriate controls in iOS and Android. In other words, creating a Button in Xamarin is creating a button object which will compile into a native UIButton object in iOS and a native Button object in Android. The common properties to both of these native objects will be available in the abstract Xamarin button object. However, if you need to dive deeper into these controls to fine-tune their appearance (i.e. add drop shadow, custom corners, custom borders, custom events…etc.) you will need to write native code to achieve your objectives. While you’ll still be using your cross-platform language, the interaction with the native object requires knowledge of the native controls’ properties and methods.

It’s also worth noting that if you need to split out into native mode for large portions of your app there may be some discomfort in working in a different architectural pattern. Native iOS follows the MVC pattern, which will be familiar to a NativeScript + Angular developer. However, if you’re using ReactNative (CQRS) or Xamarin.Forms (MVVM), you may need to acclimate to the environment. Native Android is slightly more flexible as it can be implemented to follow either the MVP or MVVM pattern.


Dependency Management


The native development community has made tens of thousands of open-source libraries available via dependency managers like Cocoapods and Maven. These libraries provide drop-in solutions for things like calendar picker controls, charts/graphs, image caching, and adding a parallax effect to controls, just to name a few. Hand-crafting this type of functionality would otherwise add days/weeks/months to a project but instead is accomplished in mere minutes/hours. Cross-platform toolsets thankfully can access this deep repository, but each has its own mechanism for importing and building a “bridge” into these native libraries. However, since they are native libraries, the open source code itself and all code samples for usage are written in the native languages (Kotlin, Java, Objective-C, or Swift.) Additionally, in the case of React Native, the “bridge” code itself must be written in Objective-C, so at the very least the price of admission here is a cursory knowledge of the native languages.

So, what is the impact to the development cycle? It depends on a development team’s ability to quickly translate from an unfamiliar language into their own. Can you at a glance capture the method signatures, properties, and events in the below Objective-C code for the MMParallaxCell library enough to translate to C# or JavaScript? 

Objective-C example of a parallaxing cell in a table view

Objective-C example of a parallaxing cell in a table view

Deployment/CI Models


Speaking as veteran mobile developer, I can tell you that one of the more painful lessons you learn early on is proper application signing. If you are unfamiliar with this process, please familiarize yourself with iOS and Android code signing techniques. Failure to be prepared when it comes time for UAT and production deployment will result in Googling the following questions: “What is a .jks file? I already created a certificate, why is it bothering me about a provisioning profile? What signing identity? I forgot my KeyStore password what do I do?” These are lessons unavoidable for the native and cross-platform developer alike.


Compilers


We also recommend learning the basics of how the iOS and Android compilers work under the covers. Of all the areas we’ve covered so far, compilation and linking issues have the potential to cause the largest amount of frustration because triaging the issue can be difficult due to the many different possible causes. You’re effectively trying to figure out the human-equivalent to fever and malaise. It could be as benign as a simple virus, but maybe it’s meningitis. Just as a physician knows how to efficiently investigate and make the appropriate diagnosis, the seasoned native mobile developer learns to recognize the subtle details in the error message and make the appropriate adjustments to the iOS Build Settings, Phases, and/or build scripts. Or in Android, maybe a simple adjustment to your gradle build script will do.


Security


One of the benefits of cross-platform tools is that they open the door for traditional web developers (React, .NET, Angular) to leverage the JavaScript, C#, and CSS tools they know and generate mobile apps with relative ease because they abstract away what’s happening under the covers. This is both a blessing and a curse, especially when it comes to securing the app from malicious actors. When a developer doesn’t know what’s really happening (other than the fact that it works) they also don’t know if they are inadvertently creating an attack vector.

Keychain for iOS

Here’s a common example. A Google search for how to persist data to a device using cross-platform tools yields many helpful results. Most of these involve reading/writing key-value pairs to SharedPreferences in Android while leveraging UserDefaults in iOS. This is a great place for saving things like user preferences, but a bad idea for saving username, password, access token, or any kind of PHI (Protected Health Information). Unfortunately, this is commonly what the developer is wanting to persist in the first place! This data is easily hackable should the phone be lost/stolen. In fact, local storage in an iOS app is stored unencrypted and easily pulled off the device by making a backup in iTunes and performing a simple dissection. A proper understanding of the native mobile security model would reveal that the user should store these types of credentials in the Keychain for iOS and KeyStore for Android.


Closing


Cross platform tools are great for many mobile solutions.  Unfortunately, they also may come with a false sense that an experienced developer with years of web development experience can simply learn the cross-platform tools and deliver the same development velocity and code quality as though the mobile solution being created were just another web app. Knowing how to use the tools in the kitchen are important, no doubt. But knowing what’s really going on when you braise ribs, sear a steak, or simmer the marsala sauce will truly make a delicious meal. If a developer can master the native aspects of mobile development, not only are those skills portable from kitchen to kitchen but they will be invaluable to making your app an ongoing business success. Does your mobile app team’s expertise extend beyond the tools to cover development paradigms and architecture? For mobile app development or training opportunities, reach out to Aptera today!

New Call-to-action

Interested in hearing more?