Live data from Hacker News

Swift Ported to Android

github.com

61–70 of 153 posts

Re: Swift Ported to Android

#61
post #5

Interesting, but even Apple doesn't use switf on iOS. So is there really a point?

On that note, MS doesn't use C# that much outside of websites. Maybe people should take the hint there as well.

My impression was that Visual Studio's UI (not all of it, but presentation layer) is C# / WPF.

Re: Swift Ported to Android

#62
post #9
post #6

Earlier quoted context omitted.

What?

Wasn't a very useful comment, but what I think he/she meant was that Apple doesn't actually use Swift much in its own apps: http://appleinsider.com/articles/16/01/18/apple-making-spars... A lot of devs take this to mean Swift should be avoided for now. Edit: To be clear, I don't agree with this sentiment! Swift is awesome. Just trying to clear up the parent comment's confusion!

Parts of OS X El Capatian are written in Swift . Source :

http://daringfireball.net/thetalkshow/139/federighi-gruber-t...

"FEDERIGHI: We have all types here within Apple. They start out with the “I love Objective-C. I don’t want to change” to “OK, maybe there’s something to this Swift thing” to “Let me give it a try” to “I love it.” We’ve gone through all the phases internally. You know, we’ve had some really great adoption by teams like … the team that does the Dock and the window management on OS X, implemented all their new features for El Capitan in Swift and started mass-converting all of their code, and say that they couldn’t imagine going back and that they’re more productive with it. Part of what our internal teams need to deal with, though, is that they’re working on, let’s say, the current version of Swift 2.0 while it’s not done yet. I mean, while it’s not even WWDC-level done yet, right? And they’re working on the interfaces in terms of our internal frameworks that haven’t been modernized for Swift. And so, they’ve got it rough. They’ve got to really love it to make that leap because they’re working on a very, very bleeding-edge environment when we use it internally. Thankfully, with Swift 2.0 now well out the door, that’s stabilized things a good bit and they’re really open to it.

But there’s been just lot of feedback. And a lot of it has helped with the impedance, making sure the impedance between Objective-C and Swift is absolutely minimized because of course we have and will continue to have and continue to write more Objective-C code, and so the ability of Swift and Objective-C code to work together completely naturally is a huge focus. A bunch of things like generic collection, support for lightweight generics in Objective-C, were big pain points internally and something we fixed in the language, and is now great for all of our app developers externally. So, it’s been a not dissimilar road for us internally to what you see outside. But in terms of Swift and writing big apps, it’s certainly the case that when Swift 1.0 came out — heck, we didn’t support incremental compilation in the very first update. And so that was going to be a limiting factor for productivity for people who had big apps. A lot of that stuff has changed. And then in 2.0 having a good error-handling model, having the availability check so you could span API versions — these sorts of things. I think it really addressed the vast majority of pain points that we were experiencing, that I think the community was experiencing about writing larger apps. And so much about Swift is actually inherently better for building big apps because it handles modules and namespaces in a way more naturally than in Objective-C. It makes the API contracts a little more clear, the code more obtainable. So, we’re very comfortable."

Re: Swift Ported to Android

#63
post #42
post #2

Interesting, in the context of Xamarin acquisition by Microsoft. Swift can very well spoil C#'s steam.

C# devs like myself are interested in Xamarin are interested because they don't have too learn new language / tooling to do mobile dev. Learning Swift isn't any more appealing than learning Objective C.

I care about syntax so Swift is far more appealing to me. Compare print("Hello, world!") in Swift to Hello World in Objective-C, which the article jokingly calls "gibberish."

https://www.binpress.com/tutorial/objectivec-lesson-1-hello-...

Re: Swift Ported to Android

#64
post #57

Surprised noone mentions Kotlin. It's quite Swift-like, backed by JetBrains (Android Studio is based on their IntelliJ Idea), and 1.0 has only just been released. It has full interoperability with Java. Given the above, I don't see much point in using Swift, unless it's one of these projects that are about proving a point (nothing wrong with that and often very interesting).

Two points for using Swift on Android: 1) shared code between your ios, mac, and android apps. 2) you already know swift.

That said, there is always a cost to using a non-standard language to develop for a platform. Things like having to translate documentation as you read it, friction between system libraries and your languages standard library, etc.

I've not looked at Kotlin in detail, but I wonder how much that friction is reduced because it's java-based, or if you'll experience just as much friction using Swift on Android as you would using Kotlin on Android. Worth evaluating if you're starting a project 6 months to a year from now as the Swift tooling for Android starts to mature.

As it stands now, I would have a look at Kotlin, but almost definitely write any projects started today in Java. Swift is nowhere near ready, and the advantage of writing in the platform's "native" language usually outweighs any benefits there are to using a "better" language.

Re: Swift Ported to Android

#65
post #57

Surprised noone mentions Kotlin. It's quite Swift-like, backed by JetBrains (Android Studio is based on their IntelliJ Idea), and 1.0 has only just been released. It has full interoperability with Java. Given the above, I don't see much point in using Swift, unless it's one of these projects that are about proving a point (nothing wrong with that and often very interesting).

Some people like to avoid Java and languages dependent on JVM. For them any non JVM based solution on android is welcome change. So efforts towards that need no justification as to why any of numerous JVM language is not used first.

Re: Swift Ported to Android

#66
post #57

Surprised noone mentions Kotlin. It's quite Swift-like, backed by JetBrains (Android Studio is based on their IntelliJ Idea), and 1.0 has only just been released. It has full interoperability with Java. Given the above, I don't see much point in using Swift, unless it's one of these projects that are about proving a point (nothing wrong with that and often very interesting).

I love Kotlin, but being able to develop libraries in one language and use them in both Android and iOS is huge. I have been using J2Objc for this until now, and while it's a great tool, it forces me to use Java, which I don't love. I would prefer being able to use Kotlin on iOS, but using Swift for Android development is a great boon.

Re: Swift Ported to Android

#67
post #24
post #12

Earlier quoted context omitted.

> C# benefits from the whole Microsoft ecosystem, which includes Visual Studio. Both good and bad. Visual Studio isn't cross-platform, for example.

Well, Visual Studio Code[1] is, so it may be coming in the future. 1: https://www.visualstudio.com/en-us/products/code-vs.aspx

I would not use the existence of an editor built on web technologies as opening the possibility that something as entrenched in Windows as Visual Studio would be leaping to cross platform.

Re: Swift Ported to Android

#68
post #9

Earlier quoted context omitted.

Wasn't a very useful comment, but what I think he/she meant was that Apple doesn't actually use Swift much in its own apps: http://appleinsider.com/articles/16/01/18/apple-making-spars... A lot of devs take this to mean Swift should be avoided for now. Edit: To be clear, I don't agree with this sentiment! Swift is awesome. Just trying to clear up the parent comment's confusion!

WWDC app was done in Swift, IIRC. Not the core app by any means, but still.

That turned out not to be quite as true as they said it was...

> While the WWDC app does in fact use Swift, it’s not as much as you might think. Out of 281 classes, only 6 are written in Swift. The Apple Store app is also using Swift for its watch app. That’s about all the production Swift I could find from Apple on iOS.

Source: https://medium.com/@ryanolsonk/is-apple-using-swift-4a6c80f7...

Re: Swift Ported to Android

#69
post #33
post #18

Earlier quoted context omitted.

You might just be looking at the language from a syntax perspective. However the two are very different in the way that you compile and run them. In C# the code is translated into a custom bytecode (IR) and then the CLR is used to execute that and manage the memory through GC. In Swift's case it compiles down to native processor code instructions and can have optimisations applied ahead of time. This allows the app t…

C# has always had support to AOT to native code since the early days via ngen. The only issue was that more effort was spent in the JIT compiler and ngen requires dynamic linking. C# is compiled to native code on Windows Phone since version 8. The C# extensions for Singularity (Sing#) and Midori (System C#) generate static binaries. Work which served as starting point to MDIL on WP 8.x and .NET Native. The new .NET N…

[deleted]

Re: Swift Ported to Android

#70
post #66
post #57

Surprised noone mentions Kotlin. It's quite Swift-like, backed by JetBrains (Android Studio is based on their IntelliJ Idea), and 1.0 has only just been released. It has full interoperability with Java. Given the above, I don't see much point in using Swift, unless it's one of these projects that are about proving a point (nothing wrong with that and often very interesting).

I love Kotlin, but being able to develop libraries in one language and use them in both Android and iOS is huge. I have been using J2Objc for this until now, and while it's a great tool, it forces me to use Java, which I don't love. I would prefer being able to use Kotlin on iOS, but using Swift for Android development is a great boon.

Could you develop libraries that way, though? It would have to be absolutely pure Swift, not using any iOS libraries, like NSURL etc. etc. - surely incredibly limiting.
Post reply on HN