Readit News logoReadit News
cpr · 10 years ago
Nice to see that Chris (Lattner) got his way. I chatted with him last WWDC right after the main Swift technical session, and he expressed the desire to open source it, but had no idea if he could get it through the powers that be.

Supporting the standard libraries on Linux is certainly a surprise, though.

sjackso · 10 years ago
Supporting Linux is a surprise, but I think it's a great move on their part.

Think: How many iOS apps are frontends to a server API? And how many of those APIs are running on Linux servers? Swift on Linux means ~all the code for a client-server iOS app can be written in the same language.

dmishe · 10 years ago
So here's the thing. They will release Apple Music for Android... and there's full stdlib of Swift support for Linux? Could it be that the Android app is partly Swift?
alkonaut · 10 years ago
It's great news. Hopefully there will be a node-like ecosystem for writing small services on Linux soon. With F#, Swift and C# available, hopefully the proliferation of Javascript can be slowed on the server (without people running to Go).
lukeh · 10 years ago
Be interesting to see if they support @objc on Linux, the Apple runtime is difficult to support because it requires the dynamic linker to notify libobjc when an image is loaded.
pjungwir · 10 years ago
I've been wondering for a while now why no one builds an Obj C backend for their apps:

https://news.ycombinator.com/item?id=9500855

Being able to deploy on Linux might be what it takes!

kristopolous · 10 years ago
The fact that I don't use OSX has been a barrier to getting better at iOS development. Hackintoshing has proven to be quite elusive and the vmware and vbox USB layers in Linux don't convince virtualized OSX enough to transfer over apps to my iDevices. I'm not convinced you can get to high quality by testing strictly on emulators.

If anyone has an old mac that can run modern xCode (you probably know what this constitutes more than me) and wants to donate it to a dedicated open-source developer for completely unspecified future projects, feel free to email me at (my handle on hn)@(googles email service). thanks

bsimpson · 10 years ago
So we can start writing articles about isomorphic Swift!

...I'll show myself out.

mozumder · 10 years ago
Apple needs to get the rest of OS X onto the server. They could build their own servers again (unlikely), or at least license OS X Server to Dell/HP/IBM/VMWare/etc..
aaggarwal · 10 years ago
I agree, with the type of growth Swift has shown in the past, there is going to be a big demand for Swift developers now. Swift could possibly rule the mobile/web. I have already added it on my #TODO list :)
tomelders · 10 years ago
I'm going to double down on my bet that Apple will position Swift as the lingua franca to replace javascript. Front end and backend.
nickysielicki · 10 years ago
Too little too late. Apple could have got my attention if they had done this from the start, but at this point I find it hard to get excited about this. Half the reason I find myself drawn to a new language is the culture and community surrounding it. You might think this seems silly at first glance, they're programming languages, not fraternities. But hear me out.

Golang is a pragmatic crowd. Go into #go-nuts on freenode, you'll notice that discussion rarely deviates from solving problems. Many links to the go playground. Go, from the beginning, shaped their community in this way. Consciously? Who knows. But the community turned out the way it did and I believe that's a result of their start.

Haskell is a computer scientist crowd. People write in haskell because they enjoy the functional paradigm and haskell is a purely functional language. Discussion on freenode? Very dense. People are expected to grasp topics easily and the community initially gives everyone the benefit of the doubt that they are capable of understanding it until they ask for more help.

When I look at swift, the only thought I have is that it is the new iOS language. I don't believe they'll be able to deviate from that. I don't see myself making iOS apps, so I don't see myself every writing a single line of the language. When I first looked at swift, my impression was that it was a wierd and somewhat-functional language that had a few unique things. Maybe I would have taken an interest in it. But at this point, I don't want to have to wade through a bunch of iOS specific questions to get what I need. I don't want to have to deal with being a beta tester for their linux implementations. I don't want to use the language when I'm probably going to be using it in a vastly different way than the rest of the community is. My interests are going to be second class.

It's not necessarily set in stone, but I think it is. In a world where there's a new language every day, I just don't see why I'd go with swift.

melling · 10 years ago
Hey, look me up in a year and explain why you were wrong.

Go has been out for 6 years and has less than 10,000 questions on StackOverFlow: http://stackoverflow.com/questions/tagged/go

Swift has 37,000 questions in its first year: http://stackoverflow.com/questions/tagged/swift

I'm a fan of Go. I built my websites in it and I've written a few small apps.

However, you really are overlooking how much of a difference the bigger Swift community will be.

All bets are off if Google officially supports Go on Android.

Anyway, 1,000,000 Swift developers will change everything.

coldtea · 10 years ago
>Too little too late. Apple could have got my attention if they had done this from the start, but at this point I find it hard to get excited about this.

That's just like your opinion man.

If Swift is Open Source it's gonna be a huge thing, for two reasons: (a) it already attracts millions of developers because it's the suggested language to develop iOS apps in, and (b) it's a nice modern language that plays in a very hot niche (with languages like Go, Scala, Rust etc).

>When I look at swift, the only thought I have is that it is the new iOS language.

OTOH, tons of people and HN and elsewhere expressed their liking for the language and how they wished it was open sourced so they can use it elsewhere too.

aikah · 10 years ago
> Golang is a pragmatic crowd

Why do people keep on saying that? Would people say javascript is for the pragmatic crowd because jsfiddle exists ? no

Go is a badly designed language period. the type system forces devs to write runtime type assertions which should be the job of the compiler thanks to parametric types, if go designers knew one or 2 things about types. The fact that Go dismisses 30+ years of type theory isn't pragmatism. It's ignorance.

Nobody would call PHP pragmatic yet even PHP is more expressive.

nnethercote · 10 years ago
> Too little too late.

This is a toxic attitude. It suggests that if people don't get something right on the first try they shouldn't try to improve it.

"Better late than never" is true in many cases, and this is one of them.

threeseed · 10 years ago
Golang is a pragmatic crowd ? Weird because it seems like an ideologically driven language.

Their attitude towards exception handling and generics has never strike me as being overly pragmatic.

Rapzid · 10 years ago
I really like Go and have written quite a bit.. But go into #go-nuts and ask about unsafe. Just as a counter point.

Dead Comment

DAddYE · 10 years ago
Chris is indeed an amazing and humble guy. I had the same opportunity to chat with him (by email) about this topic and he was so kind to answer all my questions (where he could).
thefreeman · 10 years ago
I felt the same way at first in regards to Linux support. But honestly the platforms are similar enough that a Linux fork was probably inevitable once open sourced.

Avoiding this "fracture" could have been a powerful argument for it, along with maintaining control (the nodes iojs situation could not have inspired confidence, though that was not due to interoperability from what I know)

Deleted Comment

guidopallemans · 10 years ago
Tim Cook didn't seem as enthousiast with announcing the open-sourcing compared to other announcements
cpr · 10 years ago
I disagree--Craig F announced it, and he was clearly moved.
LesZedCB · 10 years ago
I remember a thread on HN [1] from a few months ago talking about how apple was never going to do this. I'm so glad they were able to pull it off! Good for you, Apple!

[1] https://news.ycombinator.com/item?id=8488808

zamalek · 10 years ago
> a few months ago talking about how apple was never going to do this

I would have definitely participated in the hate if I had seen that thread, all I can saw now is: bravo Apple! More of this please!

enneff · 10 years ago
Perhaps there is a lesson here.
higherpurpose · 10 years ago
Or Apple saw that and decide to change its mind.

Sometimes companies change their minds this way, like how Microsoft changed its mind on the banning of DVDs for Xbox, even though they never "officially" said they would do that before the announcement of the Xbox One, but it was strongly "rumored" they would do that. I'm sure that's what they intended, but the outrage was too big to let it be.

addandsubtract · 10 years ago
Apple is never going to send me a free MacBook Pro and Thunderbolt display. Never.
rsynnott · 10 years ago
... Yes, Apple makes most of its decisions on open sourcing stuff based on reading HN. Of course.
untog · 10 years ago
They could have also been influenced by MS open sourcing .NET - it's difficult to compete if you don't keep up.
chc · 10 years ago
They haven't pulled it off yet. They've just finally stated that they intend to do so, not actually done it yet. Prior to this, they hadn't even said it was on the table. So, progress, but they still haven't pulled it off.
shawkinaw · 10 years ago
I would argue that the biggest challenge of open-sourcing Swift was getting the go-ahead, not the actual mechanics of doing it. So from that point of view, they have pulled off the hardest part.
LesZedCB · 10 years ago
Yeah, but calling it in the keynote is a pretty hard thing to back off from. I don't think they will. Hopefully it'll stay on schedule though!
abuzzooz · 10 years ago
They said it will happen by the end of 2015.

Deleted Comment

dmritard96 · 10 years ago
I will surely be downvoted for speaking so off the cuff, but I haven't really enjoyed swift so far. How has the general developer reception been to the language, not just with respect to obj-c, but also to java or any other turing complete language?
fleitz · 10 years ago
Swift as a language is pretty great, however, the tooling and obj-c interop make it a pain in the ass.

It's hard to realize most of the performance benefits when everything you're interacting with requires objc_msgsend or uses NSArray / NSDictionary.

As well, it's far less 'scripty' than Obj-c. The type system in swift really leaves something to be desired in terms of typing types. The point of Obj-C was kind of to avoid writing the kinds of apps where a great type system would really shine, swift lets you build those kind of apps, but in my opinion most of the time we shouldn't be building them.

Your project probably doesn't need 1,000 developers on it who need solid interfaces and type checking to make sure that everything is going according to the UML diagram. It probably needs 2 or 3 developers who talk to each other, add asserts to their code, and a type system thats a little forgiving.

ObjC is a language that has everything you really really need, and left out the 1 thing you kinda wanted in exchange for leaving out the thousand 1 little things that everyone else wanted too. Like for example exceptions, sure they're there, but it's not idiomatic and when you program without them you realize what a crappy idea they were in practice. In day to day coding NSError is 1000x better than exceptions.

the_af · 10 years ago
> The point of Obj-C was kind of to avoid writing the kinds of apps where a great type system would really shine, swift lets you build those kind of apps, but in my opinion most of the time we shouldn't be building them.

Can you clarify this? What is the kind of apps where a "type system would really shine"? How can you avoid writing them?

charlesdm · 10 years ago
What I personally dislike about Swift is the change in mental context when dealing with the combination of C/C++ and Swift code. Plenty of nontrivial apps use significant amounts of C and/or C++ libraries in some way.

The switch when dealing with a combination of C/C++ and Objective-C source was not really a problem. But trying to interface a C++ library into a Swift application is less than a fun experience.

Personally, while the language is fresh and seems pretty good (it has some great additions), I still prefer Objective-C. I guess I'm waiting for better integration with existing libraries.

dvanduzer · 10 years ago
Do you have any notes on this experience posted somewhere publicly? I'd love to see an overview of the issues between Swift and C++ libraries. (Boost? Not Boost? The nuances of Swift's type system?)
fixermark · 10 years ago
Swift's popularity has undergone a meteoric rise for a young language according to TIOBE [http://www.tiobe.com/index.php/content/paperinfo/tpci/index....]

But that's not surprising given its ecosystem; as others have mentioned, language success has less to do about its theoretical benefits and more to do about what environments it allows the developer access to. Javascript is the case-in-point; I think few people would argue it is a well-designed language, but if you want to do web development, you're going to need at least a basic understanding of it, so it maintains brutal popularity.

datashovel · 10 years ago
The shocking thing I think isn't how fast Swift has grown, but how fast Objective-C has fallen. The stats from that site don't appear to show that Swift has made up for that.

The overall combination of Swift and Objective-C in those numbers make me believe Apple's decision to make Swift open source is less about goodwill, and more about stopping the bleeding.

beefsack · 10 years ago
Given the context it's used in, this is hardly surprising.
chc · 10 years ago
You'd probably get more upvotes if you didn't start out by complaining about hypothetical downvotes.
narsil · 10 years ago
I've seen the opposite be true most of the time (and I have showdead on)
indians_pro · 10 years ago
he is stating what he believes will be true. i didn't read a complaint anywhere. in fact, i think he was implying how sure he was about his folliwing statments, as he was ready to post them inspite of the (expected) downvotes.

expected things are, by their very nature, hypothetical until they come true or are proven false.

AlwaysBCoding · 10 years ago
I think it's terrible. Parsing a JSON response into a Swift object takes a full-day to figure out when it's literally just JSON.parse(response) in any other language. You can't pass immutable structures (structs) into NSNotifications and I can't figure out why. It's confusing and poorly documented, and a complete chore to use.

React Native is a godsend.

coldtea · 10 years ago
>Parsing a JSON response into a Swift object takes a full-day to figure out when it's literally just JSON.parse(response) in any other language.

Something which has nothing to do with the language.

Here's how you do it with a popular Swift lib:

let json = JSON(data: response)

if let userName = json[0]["user"]["name"].string{ .... }

matthewmacleod · 10 years ago
What on earth are you talking about? Parsing a JSON response in Swift is basically the same as it is in Objective C:

  let parsed: AnyObject? = NSJSONSerialization.JSONObjectWithData(data,
    options: NSJSONReadingOptions.AllowFragments,
    error:&parseError)

briandear · 10 years ago
How is React "native" again? I'm not sure I understand how something not written in Swift or Obj. C is 'native.' This is only 30% snark; I actually don't know the answer. React is from the same people that thought html5 was a good idea for a mobile application right? I am not bashing React; I am only curious how it's considered native. Does it have official support from the iOS APIs? Can you integrate Objective C libraries with React? I just don't get it.

I also don't get how a JSON parse takes half a day. If you know the language it shouldn't take that much time. If you don't know the language then a complaint wouldn't be intellectually honest would it?

goondabba · 10 years ago
Have you tried SwiftyJSON ?

https://github.com/SwiftyJSON/SwiftyJSON

untog · 10 years ago
It's better than Objective C, so I like it. But if iOS was open to every language I doubt people would be paying much attention to it.
Tloewald · 10 years ago
Yeah it's only possible to write iOS apps with C, C++, C#, Ruby, Javascript, Python, LUA...
epmatsw · 10 years ago
I enjoyed it well enough. Didn't feel quite mature (refactoring tools, error handling, etc) and optionals are still a little frustrating, but it definitely feels like it has potential.
rmrfrmrf · 10 years ago
I love it. It's a gateway drug to functional programming, and "doing" functional programming, in turn, helps me write more expressive Swift code. It's still rough around the edges, but it's a beautiful language that's a joy to use.
carlosrg · 10 years ago
> I haven't really enjoyed swift so far

I haven't either, but I haven't used it a lot so I can't give a final verdict on it. But I'm the kind of person that enjoys C++ (well, especially after C++11, feels like a new language and I'm slowly becoming a C++ fanboy), and I guess all those new system languages like Swift and Rust are supposed to fill the void for people that don't like the existing system languages available, so maybe it's not for me.

Deleted Comment

s73v3r · 10 years ago
I find it far less frustrating to use than Java, as it actually has decent generics.
fixermark · 10 years ago
Ah, interesting. I've suddenly gone from "Not caring at all about the existence of this language" to "Mildly intrigued."

It's amazing what some opening of control will do.

BinaryIdiot · 10 years ago
I'm hopeful but until I see a license and what is and isn't opened sourced I'm going to be reserved.
ptomato · 10 years ago
OSI-approved permissive license, per https://developer.apple.com/swift/blog/?id=29
cpr · 10 years ago
One imagines it'll be liberally licensed like LLVM, which Chris Lattner also BDFLs. And they said it would be the compiler and the runtime for OS X, iOS, and (surprisingly) Linux.
zak_mc_kracken · 10 years ago
There is no opening of control, just opening of source.

You can be sure Apple will remain the exclusive ruler of what goes into Swift.

fixermark · 10 years ago
I don't doubt it. But as Iceweasel reminds us, with opening of source, dissent is just a fork away.
jophde · 10 years ago
Please for the love of all things holy please stop saying Swift would be great for Android or that Google is porting Go to Android. As an Android developer for the past four years I can assure you that there is zero evidence that Google is moving the Android FRAMEWORK to Go. There aren't even any plans to support lambdas and Java 8. Also, pretty much everyone on the bleeding edge of Android is planning on moving to Kotlin. It has even more higher level and functional abstractions than Swift or Go, full interoperability with Java (even in the same file), and almost no performance hit.
myko · 10 years ago
> There aren't even any plans to support lambdas and Java 8.

https://android-review.googlesource.com/#/c/150214/

Looks like there is someone at Google working on lambda support.

jophde · 10 years ago
Maybe but this won't ship until at least M so if you min SDK is even as new as KitKat it won't help you much.

Kotlin gives you lambdas, named parameters, extension functions (like C#), data classes, first class null, and more today on all versions of Android.

avinassh · 10 years ago
Any apps which are written using Kotlin, are on Google Playstore? If yes, link?
gtrubetskoy · 10 years ago
This places Swift right along Golang and Rust as the new interesting language.
kodablah · 10 years ago
I toyed with implementing Swift on the JVM (which is very doable by the way). The problem I've found with Swift is the minute size of the standard library. This has forced a large amount of Swift libraries to make calls to Objective-C/Cocoa classes libraries which makes it very non-portable. I haven't checked any time recently, but if a large, stable, swift-specific stdlib were to emerge then I believe it could definitely rival those other languages. Until then, most libraries will probably be Apple/OSX specific (not to mention Windows concerns).
desdiv · 10 years ago
>I toyed with implementing Swift on the JVM (which is very doable by the way).

It's already been done :D

https://leverich.github.io/swiftislikescala/

tootie · 10 years ago
I'm curious about how memory management would work. Swift has rejected garbage collection in favor of ARC.
TillE · 10 years ago
I think Rust fills a slightly different niche with its safety-first principle, but Swift should eventually be a really attractive choice for anyone building cross-platform stuff that also needs to run on iOS.
melling · 10 years ago
Swift has a huge advantage in that it's got a bigger community. It doesn't matter which language is the best. On StackOverFlow, for example, Swift has many more questions asked and answered. I've catalogued over 1000 blogs in the first year alone.

http://www.h4labs.com/dev/ios/swift.html

All this makes it much easier to learn Swift in a short period of time.

guelo · 10 years ago
Besides iOS/OSX support, what are Swift's features that make it interesting compared to other languages?
higherpurpose · 10 years ago
It would certainly be all sorts of ironic if (many) more Android apps were written in Swift than Go, all because Google doesn't want to replace Java with Go and make it the primary language, while Apple is doing that with Swift.
Redoubts · 10 years ago
I don't think any of those languages overlap much, but they all have interesting aspects.
notsony · 10 years ago
Not really. Depends on whether or not Swift's standard libraries and core APIs are all open-sourced.
wlesieutre · 10 years ago
Don't most swift apps also still drop to Obj-C? That will make them less portable.
pat2man · 10 years ago
Tim Cook said they would be open sourcing the standard libraries.
kh_hk · 10 years ago
I wonder what this will mean for Qt and QML.
rhodysurf · 10 years ago
Why? Swift is a language and Qt is GUI framework
yjgyhj · 10 years ago
People who talk about swift compare it to Rust and Go. I can see how the syntax is to ObjC what Go is to C++. Else but that, in what way is Swift anything like Go or Rust?

To me (someone who does Lisp & JS, so none of these all) go seems cool for concurrency and being 'boring' (in a great way). Rust seems cool for being very robust and 'safe' (or hard to screw up with), while still doing concurrency nicely and letting you code in high and low level.

Is there any ways that Swift is more than ObjC without [[[[all] the] square] brackets]? (nothing wrong with that, if you're not into square brackets)

chadzawistowski · 10 years ago
ObjC is really just plain C, plus some Smalltalk-like semantics within the square brackets. This means you end up with all the "footguns" of C, plus dynamic OO behavior.

Swift is like Rust in that it's intended to be fast, "safer", and compiles to LLVM bytecode. Also, Swift and Rust both use Option types for error reporting rather than exceptions or error codes.

In the same sense that Rust is a way to leave behind old C++ baggage, Swift is a way to leave behind old ObjC baggage such as header files, null pointer errors, and lack of real namespaces.

cmyr · 10 years ago
I wouldn't say optionals are necessarily for error reporting. According to this slide[0], actually, we're going to be getting a proper error-handling model in Swift 2— we'll hear more either today or tomorrow.

[0] http://www.apple.com/live/2015-june-event/eda6e3f7-0fda-4b46...

chc · 10 years ago
To name a few: Swift's type system is far more sophisticated (e.g. you can say "This is a list of numbers" and have it statically enforced that you don't accidentally stick a string in there), it does a lot of plain direct dispatch rather than Objective-C's dynamic-everything, and it uses a proper option type instead of having null landmines everywhere.
jurre · 10 years ago
Objc just got dynamics :)
gdubs · 10 years ago
It's very familiar to Objective C but also very different. Strong type system and generics as well as functions being first class citizens add up to make it a great language. My only complaint is the IDE support, which is bound to improve.
seivan · 10 years ago
Swift on Rails, who's first :) ? I suspect Heroku are working on preparing for an out of the box build pack, but I guess they don't have access yet since it's out late 2015. At least I hope so, looking for a better Ruby replacement but I still like Rails.
thibaut_barrere · 10 years ago
You should look at Elixir and Phoenix (http://www.phoenixframework.org/).
geocar · 10 years ago
They should call it Swift On Sails.
supster · 10 years ago
Haha, yeah though Sails is also a Rails like framework for JavaScript

http://sailsjs.org/#!/

xrstf · 10 years ago
Please don't, or googling "Swift Sail" won't find me Wind Waker results anymore.
roneesh · 10 years ago
I never considered this! But it's fun to think about!

I'm a bit naive about the environments languages have to run in... but if we have a web app framework in Swift, Servers in swift (as mentioned in comments above), and iOS in swift, doesn't that make Swift a JS replacement too?

opaque_salmon · 10 years ago
JavaScript's domain is mostly client side web browser scripting, and no language is close to throwing it off its throne. So no, JavaScript will always have its place.