敏捷大拇指 首页 资讯 查看内容


拷贝下载Swift Demo源代码




RemObjects 公司利用自己编译器的开发经验,推出了全新 Silver 项目。Silver 允许开发者使用苹果 Swift 编程语言进行 Android 开发。此前这家公司曾经对 C#编程语言推出过相似的项目。现在,RemObjects 又看中了 Swift。Silver 允许应用开发者使用 Swift 编程语言,为非苹果平台框架编写应用。

软件并没有将 Cocoa Touch 移植到 Android,所以并不能编写一次代码,在所有平台上运行。不过,Silver 允许开发团队使用一种语言为 iOS 和 Android 平台编写原生应用。此外,团队也支持.NET,这意味着 Swift 也可以编写 Windows Phone 应用。

欢迎注册Swifthumb.com 敏捷大拇指全球最早也是最大的Swift开发者社区!


Google Android或采纳苹果的Swift编程语言



从Android到Swift iOS开发:语言与框架对比



全球最大的Swift开发者社区敏捷大拇指 Swifthumb.com整理的淘帖:

  1. Swift开发安卓Android App
  2. Swift Linux Server服务后端
  3. Swift开发微软Windows .Net
  4. Swift和其它语言对比
  5. 开源Swift Open Source
  6. Swift 3
  7. Swift游戏开发
  8. Swift源代码 App/后台/OS
  9. Swift 高仿App源代码库
  10. Swift笔试面试题库宝典
  11. 第三方库SDK
  12. 软件工具
  13. LLVM编译器
  14. Xcode使用技巧
  15. App市场推广下载
  16. Growth Hack 黑客增长


How to Use Apple Swift to Make an Android App

Since WWDC (The Apple Worldwide Developers Conference) and Apple’s announcement of Swift, I’ve become increasingly impressed with the new language. For iOS developers, it’s a no-brainer to use Swift instead of Objective-C. Writing code is easier and faster than ever with Swift, making you more productive. And being able to write code and test it more efficiently will ultimately save developers like us time and cost.

Can You Use Apple Swift To Create Cross-Platform Apps?

The obvious benefits of Swift got me thinking: Could you use Swift to create an Android app? And, could you use Swift to write an app once for iOS and Android at the same time?

At ArcTouch, our clients regularly ask us to create both the iOS and Android version of their app. Where possible (and a good fit for the type of app), we like to use a unified code-base to bring cross-platform apps to market faster. We’ve had great success to date using Xamarin and HTML5, and if we can do the same with Swift, we’d have another great option for our customers.

After WWDC, we created a skunkworks team (led by two of our app developers, Diego Santiviago and Felipe Homma) to try building a simple app that works on both iOS and Android, written in Swift. And we succeeded with a proof-of-concept calculator app. Here’s how we did it.

Picking an IDE to Start

The first challenge was to determine which IDE (independent development environment) to use. We didn’t want to build one from scratch. And we couldn’t plug Swift code directly into Android Studio. So we started with Xcode 6. We think the best approach for a future commercial solution is to build a compiler for Swift code that you’d plug into Xcode, and that compiler would translate Swift into ready-to-run Java byte-code and an Android Package (APK) ready to install.

For the sake of our proof of concept, we took a shortcut.

Compiling to Java Source Code from Swift

Our best course of action to get something working quickly was to take Swift code and compile it into Java source code — and then take it into the Android development environment to finish building it into an installable app. So we started in Xcode, where we wrote the Swift code. Then we tested it, including running it on an iPhone or in the iPhone Simulator, and ran a custom compiler that parsed the Swift code and output Java source code (adjusting any necessary syntax, and substituting appropriate Android calls for any iOS native ones). Then we moved it into Android Studio to finish the build process and produced the Android APK.

The downside of using this approach: You need both Xcode and Android Studio on your desktop, along with our tool chain to get from one to the other. But you still see a tremendous efficiency gain by being able to use the same base code — and you get the overall benefits of using Swift.

Developing a Single UI Layer

Another challenge in building our proof of concept was the need to have a UI abstraction or conversion layer, so you can see something on screen. In iOS, you can create the user interface by writing code that displays UI features, or you can use Interface Builder or Storyboards. With Android, it’s similar: You can write custom code or define the UI by using XML or a visual layout tool.

But how do you have a single UI that translates? Tools like Xamarin allow you to take business logic and carry it over across platforms, saving a lot time, but still require the development of two native UIs. (Side note: Xamarin recently introduced Xamarin.Forms, which allows developers to create their UI once. We like this approach for apps that provide the same experience regardless of platform.)

With many cross-platform apps, you would want to take advantage of UI features specific to Android and iOS — but for this this proof of concept, we wanted to develop the UI for Android within Swift. And with our calculator, we were able to do just that, using native iOS UI calls made in Swift, then translating them to corresponding Android UI calls. It all worked beautifully.

More Exploration

We’re excited about the proof of concept and the problem our engineers solved, but there’s more work to be done if we’re going to use this type of compiler commercially. We’d love to know what you think: Would you want to write apps for Android, or for both iOS and Android at the same time, using Swift? Comment below or Tweet to us.

Eric N. Shapiro is the founder and CEO of ArcTouch. His days of working with mobile technology goes all the way back to his time at Apple, when (among other things) he was involved in the launch of the Newton. He also knows how to program in NewtonScript, which was one of Apple’s earlier forays in creating a new programming language.




*联系:微信公众平台:“swifthumb” / 腾讯微博:@swifthumb / 新浪微博:@swifthumb / 官方QQ一群:343549891(满) / 官方QQ二群:245285613 ,需要报上用户名才会被同意进群,请先注册敏捷大拇指



引用 bioswift 2016-11-21 18:34
引用 1起来 2016-10-15 22:38
引用 瑶池 2016-9-10 06:34
引用 Yole 2016-1-12 14:10
引用 rightnow 2015-6-7 03:56
引用 h5lover 2015-3-4 22:58
引用 cocoaswift 2015-1-15 01:59
《Apportable 用swift和objective-C开发Android应用》
引用 firefighter 2014-10-15 13:01
还可以用来开发Windows Phone应用?!
引用 Anewczs 2014-10-15 12:42
引用 sunshineclt 2014-10-15 12:37
引用 swifter 2014-10-15 12:18
引用 hopeany 2014-10-15 09:38








One More Thing 上一条 /1 下一条




  • 北京治世天下科技有限公司
  • ©2014-2017 敏捷大拇指
  • 京ICP备14029482号
  • Powered by Discuz! X3.1 Licensed
  • swifthumb Wechat Code