Swift language has taken the first step to encroach on Android app development

Swift language has taken the first step to encroach on Android app development

Developers can enjoy this feature from now on, but what is really worth looking forward to is the various benefits that Swift will bring after it is fully open source.

Although originally designed for developing applications for iOS and OS X, Apple's Swift language is now about to make Android development capabilities an important part of its open source Swift development direction. And according to a recent blog post by developer Romain Goyet, developers can now start using Swift for Android development.

Goyet noted that Swift uses the LLVM compiler - Goyet, incidentally, is best known for reverse engineering Apple's Siri. "The current Swift compiler plugs into LLVM to produce binaries," he wrote. "It's also worth noting that both LLVM and Swift were designed by Chris Lattner."

Instead of generating code for a specific architecture, LLVM can generate assembly code for the imagined device and then convert it into actual code that can actually interface with the target architecture.

Goyet describes the entire process as follows: The Swift compiler first generates LLVM-IR (intermediate representation) as required; LLVM then generates the ARM ELF file format based on the intermediate representation. Next, the Android NDK, which can directly use the native code language on the Android system, generates a binary link directly pointing to the generated object file. This file is finally packaged into an Android application.

However, the actual coding process does not necessarily involve all of the above steps, Goyet pointed out. "The biggest problem is the lack of SwiftCore libraries. ... At present, Apple has released a set of SwiftCore libraries for iOS, OS X and WatchOS. But obviously, it has not released any Android version."

However, not all Swift code needs to rely on the SwiftCore library. "So as long as we use a subset of Swift that does not involve SwiftCore, there will be no problem," Goyet explained.

However, Goyet has not seen any Android developed using the Swift language. "This is because the Swift language itself is only one side of the problem. The other big side or the most difficult factor to solve is that its support for Android UI frameworks is very limited. In addition, there is no Swift UI framework available on the Android system at present."

Goyet expects that Apple's open source plan for Swift will definitely include SwiftCore. "The implementation of the SwiftCore library on the Android platform should be an important part of the open source reorganization of the Swift language."

Goyet is not the only one who has ventured into developing apps for Android using Swift. Mobile development studio ArcTouch released a proof-of-concept calculator app for both Android and iOS last year. ArcTouch uses a custom compiler that parses Swift code and outputs it as Java source code. The Swift code is written in Apple's Xcode IDE and then built in Google's Android Studio IDE to generate an Android APK.

When Swift is finally released as open source, tool makers will be able to create IDEs that developers can use to write code in Swift and compile it directly to Android, ArcTouch CEO Eric Shapiro explained in an interview.

"As a programming language, Swift is very similar to Java, has a lot of similar features to C#, and it's not very difficult to compile Swift code into an Android-runnable form," Shapiro said. Although it's not clear whether Swift really outperforms Java, Shapiro pointed out that Swift is a new language and has a lot of more modern structures, and Java needs to continue to improve in these aspects before it can match it.

<<:  8 things independent developers should know before entering the industry

>>:  Tired of chicken soup? Try a bowl of "Dong Ying Gong" soup.

Recommend

The ultimate goal of palace fighting: to undergo sex change and become emperor!

There are many problems in the world that come fr...

Advertising | Analysis of the mobile advertising market in Q3 2020

Important holidays are concentrated in Q3, which ...

It’s fun to play with your phone while lying down. I loved it before I became blind.

Science and technology are the languages ​​we use...

up to date! Data rankings of 60 information flow advertising platforms!

Today I bring you the latest traffic rankings of ...

Winter Solstice copywriting collection, we are not cold this winter!

winter solstice The beginning of the coldest days...

Can we follow the trend of using AI to fill in college applications?

Free volunteer application software, proven to be...

Headline delivery: What to do if the account volume is unstable?

1. The account volume is unstable and the planned...

How much does a game server for 10,000 people cost?

How much does a 10,000-game server cost? The rent...