7 ms·
It has been 6 years since the debate of using Swift or Objective C for iOS development began. It was like pulling teeth trying to convince developers to use Sw
by melling 6y ago
It has been 6 years since the debate of using Swift or Objective C for iOS development began.
It was like pulling teeth trying to convince developers to use Swift.
https://h4labs.wordpress.com/2016/02/09/should-i-use-objective-c-or-swift-for-writing-ios-apps/ https://h4labs.wordpress.com/2016/02/09/should-i-use-objecti...
The “shiny new toy” argument doesn’t hold for long with Apple. You quickly get left behind in the Apple ecosystem if you don’t move with Apple.
While every language, environment, etc doesn’t need to move this fast, I personally prefer to jettison legacy sooner.
- _qulr 6y ago> You quickly get left behind in the Apple ecosystem if you don’t move with Apple. The number of binaries and frameworks in iOS 14 using Objective-C vastly exceeds this relatively small list. Objective-C hasn't been jettisoned by Apple by any stretch of the imagination.
- machello13 6y agoNo, but they're releasing new frameworks with Swift-only APIs. They're not "jettisoning" Objective-C, and I'm sure teams at Apple will continue to write stuff in Obj-C for years to come. It'll likely never disappear entirely. But that number will continue to shrink.
- Apocryphon 6y agoThat's only because WidgetKit uses SwiftUI. Granted, if more and more APIs become reliant on preexisting Swift-only APIs like SwiftUI or Core ML, that certainly leaves Objective-C out of the cutting edge.
- CharlesW 6y ago> Objective-C hasn't been jettisoned by Apple by any stretch of the imagination. True, but melling didn't say that Objective-C has been jettisoned. My understanding is that you can't iOS home screen widgets in Objective-C, correct? If so, isn't that a reasonably-clear signal that Objective-C developers are starting to be left behind?
- _qulr 6y ago> My understanding is that you can't iOS home screen widgets in Objective-C, correct? I don't know, I haven't looked into them. But Swift is now more than 6 years old, and iOS home screen widgets are literally only days old, so I'd say "You quickly get left behind in the Apple ecosystem" is an exaggeration.
- plorkyeran 6y agoIf you're a fan of obj-c it's perfectly reasonable to pretend that swift is just a DSL for describing views and write all of the logic for your widget in obj-c. In that setup SwiftUI is replacing interface builder xibs rather than obj-c.
- ratww 6y ago> It was like pulling teeth trying to convince developers to use Swift. Huh? That was not what I witnessed at all. A lot of people were quick to adopt Swift when starting new projects, but still didn't replace Objective-C on the older ones. IMO it was one of the sanest language migrations I ever witnessed in this industry. (Java to Kotlin in Android also as nice and same, IMO) Considering Apple still has a large Obj-C legacy, I doubt we'll see it deprecated any time soon. Carbon for example took almost 12 years to be removed!
- zapzupnz 6y agoI've seen plenty of people getting all upset that they think Swift 5.3 is still as broken as Swift 1 or 2 back when they last tried it. There are also those, some in this thread, who are proclaiming their high level language of choice as superior just because they're more familiar with it.
- Apocryphon 6y agoThere are many reasons to favor Swift over Objective-C, but "Swift is less visually noisy" is both subjective and not weak. Conciseness and expressiveness can be a reason, sure, but the article also lobs the tired "look at all those square brackets and lack of syntactic sugar" critique.
- ChrisMarshallNY 6y agoI started writing Swift within minutes of it being announced. I released my first Swift app on the store just about fifteen minutes after the RC of Xcode was released. I did a lot of ObjC, but I've enjoyed using Swift. When I create frameworks and modules, they are Swift-only (no ObjC headers), because I like to leverage native Swift stuff, like enums and whatnot. But I am writing app code. I think ObjC is a better systems language, so I don't think it's going anywhere, any time soon. It's a lot safer than "raw" C.
- nardi 6y agoIf you mean Objective-C code with minimal usage of C functions/structs/etc., then IMO Swift is actually the better systems language. Cf. the just-announced System library.
- pjmlp 6y agoThat is the ultimate goal, yet stuff like Metal gets written in a mix of Objective-C and C++14, with Swift bindings.
- nardi 6y agoCorrect me if I'm wrong, but I'd bet Metal is almost entirely C++ with a little Obj-C sprinkled on top for the API. And of course C++ is still a better systems language than Swift. My point was that Swift is better than pure Obj-C for systems programming. Admittedly, that might be a poor comparison, since Obj-C was specifically built to be used alongside C as the systems language. But yes, I think the ultimate goal is that Swift will be better than C/C++ for systems programming too. It still has a ways to go, and there are a lot of libraries that will need to be written, but I do think it's possible.
- pjmlp 6y ago> Metal is written in Objective-C, is based on Foundation, and makes use of Grand Central Dispatch to synchronize between the CPU and GPU. https://www.objc.io/issues/18-games/metal/ https://www.objc.io/issues/18-games/metal/ C++ is used for Metal shaders.
- biztos 6y agoI get this, but I also see people I'd describe as real experts saying "SwiftUI isn't ready for production, too buggy for serious apps." I'm probably going to be all-in on SwiftUI but it does make me nervous -- what if Apple decides the bugginess level is acceptable and you should just code around it if you don't like it? That's a pretty terrible outcome for people like me who are investing now in the ecosystem.
- coldtea 6y ago>I get this, but I also see people I'd describe as real experts saying "SwiftUI isn't ready for production, too buggy for serious apps." Well, there are all kinds of apps written in SwiftUI. It might not be ready to write Photoshop or Final Cut Pro in it, but most apps aren't "serious" like that. Heck, apps written in even less supported/mature environments (like React Native) will be just fine...
- pjmlp 6y agoJettison? In what language do you think Metal and Core Audio are implemented?
- Redoubts 6y agoCertainly not objc. Maybe objc++ where everything but the interface is cpp.
- deleted 6y ago[deleted]
- pjmlp 6y ago> Metal is written in Objective-C, is based on Foundation, and makes use of Grand Central Dispatch to synchronize between the CPU and GPU. https://www.objc.io/issues/18-games/metal/ https://www.objc.io/issues/18-games/metal/ C++ is used for Metal shaders.
- coldtea 6y agoI very much doubt Metal or Core Audio are implemented in ObjC. C++ or C are much more likely candidates, and is what Apple is generally using for low level code like that...
- saagarjha 6y agoAnd Core Animation is all C++ under the hood.
- pjmlp 6y agoNeXT drivers were in Objective-C.
- coldtea 6y agoYes, 30 years ago. Those went away along with DriverKit (and the performance issues for drivers due to Obj-C), when Apple created OS X. Though DriverKit has been now re-used as a name, it's C++.