Live data from Hacker News

Ask HN: Is Swift ready for production yet?

news.ycombinator.com

31–40 of 44 posts

Re: Ask HN: Is Swift ready for production yet?

#31
I personally made an app using Mapkit that's in the App Store. It's not exactly a huge or complex app but it works fine. I think it all depends on if the developers feel comfortable writing it in Swift. But the truth is why do you want it to be written in Swift? Does it really matter?

Shameless promotion: https://itunes.apple.com/us/app/mappa/id931699397?mt=8

Re: Ask HN: Is Swift ready for production yet?

#32
I have been writing Swift for 6 months now. Almost every single day. I will be shipping an App to the App Store this month written in Swift. The language is fantastic and the future of what languages should look like Swift.

However, I do not do billable consulting work in Swift. I am twice as slow writing Swift than I am writing Objective-C. The toolchain is very brittle. The debugger is near unusable. The instruction pointer bounces all over the source file while debugging. SourceKit crashes all of the time. Multiple times an hour. And build times are about twice as slow as Objective-C builds.

Swift is fine for personal projects or small libraries. I'm not going to bill hours in Swift until another major release.

Btw, I send a weekly Swift newsletter: http://www.swiftnews.co

Re: Ask HN: Is Swift ready for production yet?

#33
I think this decision needs to be taken on a case by case basis, instead of a universal answer. You need to evaluate the lifecycle of the project. If this project is going to be around for only 1 year (like a game or marketing campaign that quickly ramps up and then dies down), you're better off getting it done in Objective C. The client will be happier given their familiarity with Objective C, and you'll have an easier time explaining it to their in-house team.

However, if this is longer term bet like an app that's going to be in use after 3-5 years, you should have a honest discussion with the client about considering Swift. While Objective C is more well understood and supported right now, that might not be the case in 3-5 years. Most Apple developers would rather be writing Swift code in that timeframe, and any ObjC code will be perceived as "legacy", difficult to debug, and abandoned code that no one likes to touch.

I've worked on many iOS projects like this, which contain pre-ARC code, which no one likes to go near. Bugs in that code tend to be ignored and entire features are left to rust because the source code is so dated that it's better to leave it alone than risk breaking anything by modifying it. If this project could end up in that state, it's better to be future-proof and start with Swift. However, if it's a short term app, choose the path of least resistance, which seems to be Objective C at the moment.

Re: Ask HN: Is Swift ready for production yet?

#34
post #22

Earlier quoted context omitted.

https://medium.com/@stigi/swift-cocoapods-da09d8ba6dd2

Since that's been written, CocoaPods has added Swift support. As of a few weeks ago it's currently available in beta (gem install cocoapods --pre). To the OP, CocoaPods is probably the most widely-used package manager, but there's also Carthage too, which is decentralised: https://github.com/Carthage/Carthage It'd be nice if Apple had an official package manager but they seem to want to stay out of it (see Homebrew/M…

Want macports semi developed by apple staff?

Re: Ask HN: Is Swift ready for production yet?

#35
As a datapoint: we build the Minuum Keyboard (http://minuum.com), and our iOS version was written from the ground up in Swift. That is shipped in the App Store and has been since iOS 8 launched.

To echo much of the sentiment here: the language is definitely usable in production now. The tooling is not ready yet. We have wasted untold hours dealing with XCode crashing. If you're contracting this out keep in mind those hours.

There are also some issues with the bridging to Objective-C for Cocoa APIs. As an example: we've had a few cases where for performance reasons we've needed to replace Swift arrays with NSArray objects.

That said: there's a lot to like about the language and there are parts of our codebase that are really nice by virtue of being Swift.

EDIT: I want to agree with a number of people here about using the language your contractor is comfortable with. If you don't have a strong in-house reason to use Swift, Objective-C is going to be around for a long time, so I wouldn't worry about that.

Re: Ask HN: Is Swift ready for production yet?

#37
post #25

I've been coding full-time in Swift for the last three months and at this point our source base is about 10K lines of code. Given this experience, if I had to do it all over again, I'd probably choose Swift again. The good: - Swift is a far better language than Objective-C. It's much safer, the type system is great, and the functional features are a joy to use. - Everything largely works as advertised; even for a sup…

    >But at the end of the day, if you're hiring an outside company to do this, why does it matter to you what language it's written in? Shouldn't they be able to use their best tools?
Unless the owner wants to be forever betrothed to the outsourcing company the language selection is a valid concern. For instance, [she|he] may want to take over updates when iOS9 comes out and plans on being proficient in Swift by then.

The owner should weigh why they wanted Swift in the first place vs. the consultant's recommendation and then decide from there.

Re: Ask HN: Is Swift ready for production yet?

#38
post #29
post #20

I've recently been re-writing an old pet project from Objective-C to Swift. I've found the Swift error messages incredibly unhelpful in Xcode compared to Objective-C, but the resulting code to be a lot more readable and concise (and therefore, importantly, much more maintainable). I find myself writing a lot less 'glue' code too. On balance, I probably found the Objective-C code easier to write, partly because of Xco…

... I probably found the Objective-C code easier to write, partly because of Xcode support and partly (if I'm honest) because it lets me do more dumb/unsafe things, which should probably be discouraged. That same argument was used in the '80s by Pascal proponents against C. Would the software we use today be better if it all were written in Pascal instead of C? Yes, there would certainly be less buffer overflow explo…

The Linux Philosophy of a kernel that runs on everything from a super computer to a smartphone is sort of misguided I think. You can write much smaller and potentially faster kernels if you focus on one architecture and use case, see for example the Oberon project (it uses a pascal descendant for its system language, also called Oberon) or the Mesa/Cedar system at Xerox Parc. With time I'm sure that kernel designs like the Singularity OS one will take over: Invent a systems programming language that allows for better static analysis and verification of driver protocols. Then run everything at ring 0 and identity mapped virtual address translation, with most of the applications written in memory safe languages or virtualized in app containers. That way context switches, which incur huge overhead, as well as heavy weight processes are a thing of the past.

Re: Ask HN: Is Swift ready for production yet?

#39
Interesting coincidence... I developed a game [1] in Swift and posted it as a "Show HN" about an hour ago [2].

Initially, I admit that I did have some rough times as I worked through all of the Xcode 6 betas, and that was quite challenging. However, things have definitely gotten better with production releases of Xcode.

I know that it's a game and not a traditional app like you are developing, but I think my game shows that you can achieve a quality result with Swift.

[1] https://itunes.apple.com/us/app/rocket-renegade/id955229059?...

[2] Show HN: Rocket Renegade, a Space Shooter for iOS in Swift

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

Post reply on HN