TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why many developers still prefer Objective-C to Swift

212 pointsby Udo_Schmitzover 7 years ago

40 comments

orbiturover 7 years ago
I work for a company that writes iOS apps, large and small. When Swift 2 came out, any new projects we started were in Swift. We still maintain several large and small ObjC apps.<p>If I had my way while were planning out a &quot;big&quot; app, it would be ObjC.<p>- ObjC isn&#x27;t going anywhere, and it continues to receive improvements<p>- Xcode 9 can still barely handle large Swift apps; I consistently lose syntax highlighting and autocompletion<p>- Equivalently sized ObjC apps clean build in approximately 1&#x2F;3 of the time<p>Swift as a language is fine. There were some neat new concepts it forced me to learn, and I look forward to writing it. But the tools make me want to work on anything else.<p>edit: Also I was really, really looking forward to Swift 4 &amp; Xcode 9. I hoped there would be improvements in build time and less IDE problems, but I see no noticeable change in build time, and Xcode routinely leaves me unable to quickly make changes to Swift code, either because indexing failed and autocomplete is suggesting random shit or because autocomplete isn&#x27;t there at all. Then I switch tabs and for a moment I&#x27;m looking at syntax highlighting until it just... disappears. Maybe changing a line will fix it, maybe it won&#x27;t. Xcode 9 might actually be worse in this respect.
评论 #15422681 未加载
评论 #15421988 未加载
评论 #15421943 未加载
评论 #15421822 未加载
评论 #15423380 未加载
评论 #15423863 未加载
评论 #15422393 未加载
评论 #15422687 未加载
aplummerover 7 years ago
I think a lot of these comments are directed at Xcode and tooling, not Swift specifically. This is unfortunately just the trend with where we are at with new desktop mac software, hopefully High Sierra&#x27;s focus on improvements over features will be a turning point, Xcode 9 does seem to be on the right track.<p>When I was out of the office this week, two server side java developers helped a Swift junior step through some code - they both were really surprised and impressed at just how approachable Swift is. As well, I notice daily how few runtime errors and issues we have with Swift code-bases comparatively.<p>I think a lot of these comments are straw-manning the language. Yeah, people don&#x27;t like being beta testers, or using immature and changing software vs very mature and stable software - that&#x27;s not comparing two languages themselves though.
评论 #15423917 未加载
iOSGuyover 7 years ago
Swift is great for a small app, with a handful of developers. For a platform, which interops with multiple languages, being worked on by a large team of engineers, switching to Swift would just be silly.<p>Oh yeah, let me increase my compile times, the size of my SDK, add complications for my publishers, see zero performance benefit, build a ton of scaffolding code, add yearly tech debt until Swift is actually a mature stable language. Terrible idea!<p>It might be the gold standard some day, but for now it&#x27;s just a kid compared to ObjC, and everything that comes with being a C based language. If you&#x27;re learning to make apps, by all means, you should learn Swift, but it will be quite a long time before ObjC is dead and gone, so be prepared to learn both young padawan.<p>Not to mention, the hype train&#x2F;bandwagon is really muddying the waters. It&#x27;s probably a bad idea to take advice on how performant&#x2F;powerful Swift is from a Zealot, or someone that&#x27;s betting everything on it.
评论 #15421936 未加载
评论 #15421815 未加载
评论 #15423488 未加载
jordansmithnzover 7 years ago
I’ve developed primarily with ObjC for about 4 years, and when Swift was released, primarily with that - so roughly an even amount of time with each.<p>The article has a lot of very opinionated comments, some of them not true (e.g. ObjC development has not completely stopped). There are definitely some truths in there too, like how fluid the language has been so far (last year’s Swift code probably won’t just compile this year).<p>In general, I think it’s fair enough to say that Swift hasn’t matured yet. It’s not so stable, and tooling isn’t great. Large projects might suffer from that. ObjC on the other hand is rock solid, but lacks some of the more modern language features of Swift.<p>Personally, I’m all for Swift, because it’s the future. Tooling issues and stability can (will?) change. Turning ObjC into a modern, next generation language just isn’t something that seems feasible.<p>Aside from that, Swift is a really neat language - tooling aside, I find that Swift is (mostly) a great language to write in, with features that I’d sorely miss going back to ObjC. That’s purely opinion though, I’m sure there’s others that might say the same from an ObjC standpoint.
dretaover 7 years ago
We started using Swift on new projects. I don&#x27;t hate it per-se, but as with most new languages like Rust, or Kotlin, they have some neat, modern ideas, but mostly they help solving none of the problems you have on a day-to-day basis, and instead make common coding tasks harder.<p>Using Swift feels like i&#x27;m back in college writing C++ code while following all the newest design patterns, and best practices, thinking about whether i should make two classes friends or not, instead of solving actual problems.
okdanaover 7 years ago
I think the Swift language is great, but the tool chain (specifically `&#x2F;usr&#x2F;bin&#x2F;swift` and `&#x2F;usr&#x2F;bin&#x2F;swiftc`) is absolute garbage. The documentation is almost non-existent, its preferred method of &#x27;handling&#x27; errors is to just segfault, when it <i>does</i> give you an actual error message it&#x27;s completely nonsensical, and as mentioned it&#x27;s very very slow.<p>I think i&#x27;m a version or two behind the latest, so maybe it&#x27;s better now, but that&#x27;s been my experience so far.<p>Anyway, in spite of the above i still prefer it to ObjC.
Koshkinover 7 years ago
For people coming from C&#x2F;C++&#x2F;ObjC, certain things in Swift can take some time to get used to, e.g.<p><pre><code> if case .Success(let person) = personResult { ... } </code></pre> My first thought when I saw this was, &quot;only a mother could love this syntax&quot;, but later you come to appreciate and enjoy it.<p>Link: <a href="https:&#x2F;&#x2F;www.natashatherobot.com&#x2F;swift-guard-better-than-if&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.natashatherobot.com&#x2F;swift-guard-better-than-if&#x2F;</a>
评论 #15422337 未加载
评论 #15421900 未加载
评论 #15421843 未加载
评论 #15425274 未加载
madroxover 7 years ago
All the junior mobile engineers I’m interviewing now are learning iOS development on Swift. Junior engineers are probably the most pragmatic programmers on the planet. When they’re choosing to learn Swift vs ObjC, none of them are saying “...but ABI stability!” They’re learning Swift because they’ve found they can make apps faster with it.<p>Tells you all you need to know about the future right there.
评论 #15422295 未加载
评论 #15422058 未加载
评论 #15422470 未加载
评论 #15422053 未加载
评论 #15422573 未加载
评论 #15423096 未加载
Koshkinover 7 years ago
The nice thing about Objective-C is that it combines two excellent distinct languages - C and Smalltalk. Swift, on the other hand, introduces a completely new universe. Which many swear is a good thing.
askafriendover 7 years ago
No one said the future would be painless to adopt. What&#x27;s obvious is that Swift most definitely <i>is</i> the future. Apple has made their commitments clear. There&#x27;s no stopping that train so might as well get on-board.<p>That&#x27;s my view.
评论 #15422410 未加载
aryehofover 7 years ago
For better or worse, Swift will become the only choice known by a new generation of programmers.<p>Merit and past lessons learned, are not really how concepts, practices and techniques become popular in computing. Alan Kay had it so right when when he said that computing is a &quot;pop culture&quot;.
greensamuelmover 7 years ago
The real point that I think this article misses is framework development. Swift <i>still</i> has not achieved ABI compatibility. If you are using an iOS device, very likely framework code I have written in the past few years is running inside one of the many apps you have installed.<p>This is simply <i>not feasible</i> to do unless you are willing to open source your code base. I have been shipping closed source binary frameworks written in Objective-C for seven years. None of the companies I work for are willing to maintain binary releases for each version of Swift AND Xcode. It&#x27;s simply too much.<p>I&#x27;d love to use Swift, but at this point it would only be a maintenance nightmare for my team and I to maintain.
评论 #15422322 未加载
评论 #15422159 未加载
评论 #15422578 未加载
评论 #15422203 未加载
nickgrosvenorover 7 years ago
Because they&#x27;re more comfortable with it
评论 #15421486 未加载
cagefaceover 7 years ago
My apps stopped crashing when I started writing them in swift. That alone is worth any hassles with an immature language or tooling.
blunteover 7 years ago
Legacy code. That&#x27;s the primary reason some people haven&#x27;t jumped the Swift bandwagon.<p>Newness (which includes rapid, breaking changes in language and still-to-be-improved tooling) would be number two.
评论 #15421773 未加载
评论 #15421906 未加载
let_varover 7 years ago
Here&#x27;s something from the point of view of a Swift engineer who had multiple conversations with experienced Objective-C developers.<p>1st. Don&#x27;t look at it from the language perspective. Look at it from the point of view of the platform and dozens of SDKs that comes with it. It&#x27;s lot easier to use those SDKs in an environment you are already comfortable with.<p>2nd. There&#x27;s no financial incentive for an existing app to be ported to Swift or train experienced developers to this new language. In my manager&#x27;s own words, &quot;...you have to give me a business justification to port our app to Swift...&quot;<p>3rd. I&#x27;m afraid to say that incredibly high inertia about learning and embracing a new language, and letting go of your stronghold.<p>Swift is an amazing language, and it&#x27;s quite easy for you to switch between Swift and other C-style language e.g. ECMAScript. Objective-C has somewhat obfuscating syntax that makes it intimidating for beginners.
评论 #15423213 未加载
cm2187over 7 years ago
Is Apple really pushing for swift to be adopted in schools and colleges? Given that it only runs on iOS and MacOS (expensive platforms) and that you need to pay some fees just for the privilege to create your own iOS app, it&#x27;s not an obvious candidate in my mind, irrespective of the language&#x27;s own merit.
评论 #15422488 未加载
评论 #15422396 未加载
评论 #15422400 未加载
Apocryphonover 7 years ago
It&#x27;s pretty awful- there&#x27;s not a lot more beginner material for Objective-C anymore. Even if you think it&#x27;s for legacy work only (Facebook and  itself have a word with you), it&#x27;s still needed to learn. Many many apps are too big to rewrite in Swift. Don&#x27;t discount your roots.
s_kilkover 7 years ago
I haven’t touched macOS&#x2F;iOS development in a while, but I feel Objective-C has a certain graceless charm which just isn’t there in Swift.
评论 #15423191 未加载
3chelonover 7 years ago
Wow, that was quite a whining article. I mean, I doubt I&#x27;ll ever forget Obj-C but Swift is now my goto language for iOS projects. Reminds me of when I was reluctant to abandon assembler for C. Get over it.
Grustafover 7 years ago
I wonder how long we will keep hearing the complaint that Swift keeps changing. I never saw that as a problem at all, 99% of the changes have been for the better, and most of the time it&#x27;s exactly the things I have wanted them to change, or add.<p>For the first few days after the announcement I couldn&#x27;t see the point of Swift, why did Apple feel they needed a new language? It&#x27;s not like there was a dearth of developers in objc. I started reading the Swift book from Apple though, and when I finished it a few days later I was hooked. Since then I haven&#x27;t voluntarily written a single line of objc.<p>Of course circumstances may vary but for us migrations between Swift versions, even the biggest ones, have never taken more than 2 hours. Learning the new syntax as a developer I see exclusively as a positive, it&#x27;s exciting to see how it develops. WWDC is Swift Christmas.<p>Again, each project and each developer is different but I can&#x27;t shake the feeling that at least some of the objections raised by obj c diehards sound like pretexts, especially the talk about the language being in flux. It&#x27;s not like you&#x27;re forced to adopt the new version immediately, and in any case APIs also change. It&#x27;s just part of the job. And Swift can&#x27;t improve if it&#x27;s not allowed to evolve.
评论 #15424425 未加载
评论 #15424176 未加载
xirdstlover 7 years ago
Does anyone use AppCode? How does it stack up to Xcode for Swift development?
评论 #15423975 未加载
评论 #15431369 未加载
Razenganover 7 years ago
I&#x27;ll just add my 0.02 and say that for writing games, at least, I cannot imagine a better language than Swift, unless it&#x27;s a slightly better version of Swift.<p>Combined with SpriteKit&#x2F;SceneKit&#x2F;GameplayKit&#x2F;Metal, it&#x27;s a decades-long dream come true.
评论 #15423417 未加载
评论 #15423245 未加载
gokover 7 years ago
Swift is a really cool, but in many ways more complementary to ObjC than a particularly great replacement for it. A lot of the things uniquely interesting about ObjC (truly seamless C&#x2F;C++ interop, tiny lightweight runtime, learnable in an afternoon for C users) are explicit non-goals of Swift. So it’s not surprising that developers who found ObjC to be a good fit for their problems aren’t always finding Swift to be the right tool.
betadreamerover 7 years ago
Swift is a good language. Especially if you are new to Apple ecosystem. Objc looks ugly and scary. But after 5 years of objc, I actually like the bad things about it lol<p>What I don’t like about Swift is that it evolves every year. I already need to maintain new OS updates and new devices. I don’t want to have another thing that I need to maintain... especially the language itself.
评论 #15422297 未加载
applecorruptionover 7 years ago
Very right. Swift development is been lately only rewritting , language change every 6 month and all apps do not compile anymore.
评论 #15423524 未加载
mattschmulenover 7 years ago
While legacy iOS developers are justifying objective-c over swift. Swift is “eating the world” of iOS and macOS app ( and some server side ) development, avoid it at your own peril. The Xcode issues are undeniable but it does not change the situation. swift lang is superior and it is the overwhelming choice for new apps and new developers.
Abishek_Muthianover 7 years ago
Say a fund constrained startup, with single iOS developer who is experienced in Objective C. There’s no reason to go for Swift if building MVP is priority; as it should be for any startup. If compile times are longer in Swift, it increases cost on new hardware as well.<p>So cost plays an important role in the adoption of Swift as well.
评论 #15422061 未加载
评论 #15423153 未加载
评论 #15423221 未加载
jasonwelkover 7 years ago
I primarily develop iOS apps in C++ so using Objective-C for the platform stuff is a no brainer thanks to mixing that language with C++ in the same source files.<p>I really like Swift though and hope tooling improves so I can start doing more with it. I love its approach to type safety and offerings like ADTs.
lisperover 7 years ago
Because I can seamlessly call ObjC from Clozure Common Lisp through the ObjC Bridge&#x2F;FFI.
currymjover 7 years ago
in some ways these complaints remind me of trying to pick up Haskell or Rust -- tooling isn&#x27;t quite there, breaking changes all the time, outdated resources online. funny that Swift, another &quot;weird&quot; type-heavy language, has the same problems.<p>i wonder if part of the IDE problem isn&#x27;t to do with having the elaborate type system. it might make certain things easier but having to do inference could slow things down a lot.<p>my dream is that someday Swift will be a mature, well-funded, &quot;enterprisey&quot; language that is also weird and functional. Something to join the ranks of F#.
coldcodeover 7 years ago
I don&#x27;t know any, at my employer are all trying to replace years of ObjC no matter the cost.
评论 #15421881 未加载
dev1nover 7 years ago
Because the app size is an order of magnitude less than it would be with swift.
评论 #15421918 未加载
whipoodleover 7 years ago
I think Marco has the most reasonable posture here. Though I must admit I personally wouldn&#x27;t want to use PHP.
评论 #15423165 未加载
frusciante29over 7 years ago
A: Because they can&#x27;t let go of the past
sheeshkebabover 7 years ago
Swift is nice although it doesn’t have any advantages for someone who knows objc. Plus for interoperability you still need to know c&#x2F;objective c anyway, and then why bother.<p>I guess Swift is popular with JavaScript developers, coming from web dev.
评论 #15421886 未加载
评论 #15422692 未加载
评论 #15421707 未加载
crispinbover 7 years ago
I shall add this to my HN thread generation algorithm:<p>- article queries developers of category X: why do you do Y?<p>- 1000 replies appear as variations on the theme &#x27;no, it&#x27;s just because Z!&#x27;, clearly implying category X either lacks the ability to introspect on their own reasons for their choices, or are perhaps knaves or fools
coinover 7 years ago
&gt; Steve Troughton-Smith: Fully excluded; a Swift-only conference is one that has nothing for me. I don&#x27;t want to have to care about Swift best practices or design patterns now before the language is fully formed and before Apple is using it at scale. I don&#x27;t want to collate a dozen community-led design patterns, I want to do what Apple does.<p>So if it&#x27;s not endorsed and spoon fed by Apple, he wants nothing to do with it.
评论 #15423269 未加载
评论 #15421647 未加载
bitmapbrotherover 7 years ago
I&#x27;m surprised by the resistance of some of these iOS developers. You would think that after years of developing in a language that looks like diarrhea they would have gleefully switched over to Swift.
CHANCECHANELover 7 years ago
Uhh because Swift threatens their job? Objective-C is an abomination, which has kept Python&#x2F;Ruby&#x2F;JS developers away. Swift on the other hand greatly simplifies switching between, JS,Python,Swift. From employers perspective this opens up a huge talent pool, for employees especially the Objective-C hipsters its a bad news, since their privileged status in the app economy is now under threat.<p>I don&#x27;t see any sane new startup&#x2F;projects using Obj-C, other than bullying by Obj-C devs.
评论 #15421786 未加载
评论 #15421696 未加载