Archive for September 18, 2015

Friday, September 18, 2015

Objective-C Is Our Generation’s COBOL

Drew Crawford (tweet):

Sometime this year, probably right around now, Swift will surpass ObjC in search traffic. The number of people trying to google some Swift question will be greater than the number of people googling some ObjC question. Around now. Not next year, not when you’re planning your next major version and might have more time to think about porting a few classes. Right now.

[…]

Pretty much every new iOS developer I talk to is learning Swift. Not ObjC. Not Swift and ObjC. Just the Swift.

[…]

Your ObjC codebase isn’t going to go away. Just the people willing to work on it. Sorry.

My first reaction is to point out that of course there’s more search traffic for a language that’s new, in flux, and much more complex than its predecessor. That said, it’s quite possible that we have reached Peak Objective-C.

I’m having a good experience with Swift so far. It fixes so many things that have long annoyed me. There are certainly problems with Swift, but Apple is working at an impressive pace to address them. I do worry a bit that using Swift is going to paint me into a corner. Crawford writes:

Swift is essentially a superset of ObjC. Other than a few weird trivia questions (#pragma pack anyone?) you can do everything in Swift that you can in ObjC, and much, much, more.

This is mostly true, and you can migrate code piecemeal, but it does seem like there’s a point of no return. First, you cannot subclass a Swift class in Objective-C. Second, it doesn’t interoperate with C++. Third, Apple doesn’t really talk about it, but the bridge for Objective-C and Swift strings and collections is not toll-free. There seems to be overhead in just passing bridged objects back and forth between the two languages. This is probably not a problem in most cases, but it’s not clear to me what you can do if this bites you.

This is more a problem with Swift interoperating with Cocoa than with Swift the language. But if you’re writing an app, working well with Cocoa is what matters.

Ben Sandofsky:

I’m bullish about Swift, but it’s nuts to port a large, mission critical app to it, today.

Andy Matuschak:

This is a pretty accurate analysis. Having been an early patient, I can report mixed outcomes and excitement about the future.

Tim Burks:

I’m aware of two projects, one at a startup and one at a big big company, that were rewritten in ObjC after starting in Swift.

Ben Sandofsky:

Every new line of Objective-C you write today is technical debt in a Swift world.

Update (2016-03-22): Joris Kluivers:

Had to revert back to Objective-C for a delegate implementation. NSDictionary -> Swift Dictionary conversion for a param didn’t perform well

Facebook “Like” Button Tracking

Kashmir Hill (tweet):

Four years ago, Facebook promised that the “Like” buttons that had sprung up on non-Facebook sites all around the web wouldn’t be used to track users. In 2011, Facebook said, “No information we receive when you see social plugins is used to target ads; we delete or anonymize this information within 90 days, and we never sell your information.”

[…]

Now, every time you visit a site or use an app that has a Facebook “Like” or “Share” button, data about your visit will be captured and fed into Facebook’s advertising algorithm, even if you don’t actually click on the buttons. Millions of sites use Facebook’s off-site buttons, including many popular news sites, e-commerce sites, and, yes, adult entertainment sites.

Bitcode Breaks 3rd-Party Crash Reporters

HockeyApp (via Landon Fuller and Andreas Linde):

It is currently not possible to support crash reports from builds using Bitcode. When uploading an app to the App Store and leaving the “Bitcode” checkbox enabled, Apple will use that Bitcode build and re-compile it on their end before distributing it to devices. This will result in the binary getting a new UUID and there is no way to download a corresponding dSYM.

Swift 2 Generic Support for @objc Protocols

Joseph Lord (via Swift Sandbox):

Just had a response to a radar (thanks Apple Swift team) that you can now implement Objective C protocols with generic Swift classes. This means that you can make typesafe and composable classes to do much of the work for many UI objects without ugly wrapping code and indirection.