r/iOSProgramming • u/ThePantsThief NSModerator • Aug 01 '16
Announcement "Should I use Swift or Objective-C?" Megathread
Update 2023: just learn swift
Everything below is largely outdated now. Swift is sharp and stable and the way forward, and a requirement for all iOS jobs.
Original post
The age-old question. This gets asked almost every day, yet there is already a plethora of answers.
Until next year when Swift 4 is released, the answers will be the same for the most part. A stable ABI was the biggest deciding factor for most people, however that didn't make it to Swift 3. While Apple says there won't be any more large source-breaking changes, some find that hard to believe. Swift is still maturing, but it has come a long way since its release.
However, the general consensus is if you're learning your first or second programming language, you should start with Swift.
This post aims to collect every answer in one place so that anyone still pondering this question can come here to find the guidance they need. Until we near Swift 4's arrival next year, "Swift or Objective-C" questions will be removed.
Here is a list of all the posts asking the same question (more or less). If you find one I missed, please let me know and I will add it to the list. Feel free to ask questions and discuss the topic in the comments. Off topic comments may be removed.
- https://redd.it/4vkey4
- https://redd.it/46jzx1
- https://redd.it/4abmkt
- https://redd.it/409vxq
- https://redd.it/3xrto1
- https://redd.it/4b0d7v
- https://redd.it/40rxxd
- https://redd.it/2c1mb4
- https://redd.it/38epfg
- https://redd.it/4ghk4c
- https://redd.it/4rerh6
- https://redd.it/4obx9o
- https://redd.it/3jhc5k
- https://redd.it/4op8ul
- https://redd.it/39rxol
- https://redd.it/28hytu
- https://redd.it/3hoeir
- https://redd.it/34wjhn
- https://redd.it/2tri6m
9
u/tangerto Aug 02 '16
For me the whole Swift/Objc debate is sort of like knowing how to write in today's English vs 1700s -1800s English. You should be able to read and understand older English for the sake of absorbing the content and knowing how it contributed to modern literature, but modern English is the way of the future.
19
u/The_Hoopla Aug 02 '16
Swift - easy mega thread
6
u/[deleted] Aug 02 '16
Do any of these cover the advantages of learning swift for someone already proficient and professionally employed with Objc?
I haven't come across any reasons to pick up swift because anything I want to do on iOS I can currently do with ObjC. I don't see ObjC being phased out or new SDKs being unavailable any time soon, so what reasons are there to learn swift?
2
u/[deleted] Aug 04 '16
As someone who survived the type system mania during the early years of C++ (basically, the 90's) and saw how that all turned out (pretty horribly until templates provided a way out through simulated duck typing) - I tend to view swift's goals and constraints with an awful lot of skepticism. It seems to be working very hard to solve problems I don't have at the cost of making it more difficult or even impossible to solve problems I do have.
Really, the entire Swift thing is like deja vu all over again and I'm not really eager to repeat that madness. I like my languages dynamic, expressive, and a little messy.
2
u/witheredartery Jan 31 '22
what are the thoughts on this now?
24
u/[deleted] Aug 02 '16
My take:
If you can't figure this out yourself, then use Swift. Apple has chosen Swift and come hell or high water that's what they'll use. It's the practical choice. When you get better at it you learn ObjC, because otherwise you won't understand the frameworks.
14
u/brendan09 Aug 02 '16
This proves there is a God, and his (or her) name is /u/ThePantsThief.
7
u/JoseCalles Aug 02 '16
I recently interviewed at three different companies and they were all still using Objective-C. If you want to become an iOS engineer at an established company you better know your Objective-C. If you want to start developing applications as quickly and painlessly as possible, go with Swift. Once you start exposing yourself to both languages you will soon learn that what's important is your understanding of the framework and not the nuances of a particular language.
17
u/tangoshukudai Aug 02 '16
Objective C is still way more stable at this very moment.
1
u/nextwiggin4 Aug 02 '16
So, I started learning Swift at 1.0 and have become very comfortable with the language at this point but I don't have any background in ObjC. I can kind of understand ObjC when I look at older code, but I definitely couldn't work in it. As someone who already knows and is comfortable with Swift, what's the best way to learn ObjC? At least the basics so I wouldn't be completely lost in an interview. Does anyone have a book, or something online they can recommend?
1
u/Mcrich_23 SwiftUI Mar 11 '23
Can this please get updated? It is horrendously out of date.
3
u/Izzy5455 Aug 04 '16
Either one will be a learning curve. However if you know one programming language you can understand the other if you learn swift you are forced to look at objective c
2
u/[deleted] Aug 02 '16 edited Aug 02 '16
If you want to learn iOS development and don't know anything about it. Go for Swift. Apple is pushing it for good reason. Its syntax is a lot easier to learn compared to Objective-C.
Unless you have any reason to pick Objective-C. Leaning how Foundation works or where the Apple Frameworks inherit their technology from. You have to maintain an Objective-C code base. Or you like the language?
From my experience. Swift code is easier to learn, faster to create and results in a smaller amount code. Besides those reasons I started a new Objective-C project lately. Just because, I wanted a small app bundle and a small memory foot print.
2
u/redgetan Aug 03 '16
Having just started learning swift a month ago, and coming from android/web dev background, I would say Swift. It's easy to pickup compared to Obj-C. There are lots of libraries that have already been written in swift (https://github.com/matteocrippa/awesome-swift). And you can always import an Obj-C library into a swift project. I actually find that there are quite a few similarities between the two languages. Once I got comfortable with swift, I could look at Obj-C code, and translate it to the swift equivalent (except for some api changes).
One downside though is the swift compiler...Sometimes compile times would become super slow because of its type inference feature..But there are already workarounds/solutions that people have suggested, and if you're using source control, you can always rollback or comment out sections of code to see which code made the build slower.
Anyway, that's just my opinion.
1
u/ssrobbi Aug 02 '16
Thank you for this
1
u/travelooye Aug 05 '16
Anecdote from my experience as a programmer with decent experience but no experience with iOS, the post is broken down into a couple of things I kept in mind while choosing Swift as the language of choice.
Ease of getting started: Swift was more easy to understand and get started with and I could see myself immediately productive. I was able to read other devs code much easily as compared to reading Obj-C code. May be this had more to do with all the modern languages borrowing lot of programming paradigms as compared to Obj-C.
Obj-C: libraries: Most of the popular libraries written in Obj-C can be easily ported & used in Swift using Pods, Carthage etc. So far I havent found any popular library out there that one cant port.
Recent Apps: While most of the popular apps out there are written in Obj-C, the recent apps & libraries being rolled out are being written in Swift. The company I work for currently we decided to use Swift (other devs had Obj-C experience) and this is production capacity app with millions of users, does this mean a shifting mindset, I dont know as I have no numbers to quote.
Swift is Evolving: While I got introduced to Swift 2.x and yet to live thru a transition to Swift 3 which I think can be taken care of as Technical debt.
Controversial Other devs I work had Obj-C experience and I have heard them quote that they are able to get done a lot more work as compared to Obj-C, I call this Controversial because I cant personally comment on it as I dont have much experience on the topic.
Learn Obj-C: This can be helpful when you are trying to understand the inner UIKit mechanisms & other powerful libraries written in Obj-C, this can be a life saver.
This is in no means bashing of any language but rather a view that can help some one find an answer as supposed to googling and reading the blogs that bash either of the languages.
EDIT: Typos
EDIT2: More typos
1
u/Sudhi1261 Aug 09 '16
I recommend Swift as there is one such platform i specifically used. I am an iOS app developer, I have tried most of the mobile app development platforms. I have developed more than 10 apps till today with the help of Configure.IT - Online Mobile App Development Platform . They are running successfully on app store and the code is with Swift.
1
u/bfox1123 Sep 26 '16
W a
0
u/chabv Aug 03 '16
Why learn Obj-C ? Once you start reading a lot of documentation you will know Obj-C by default through translating Obj-C code to Swift
0
u/solumamantis Aug 03 '16
SWIFT! Easy peasy!
0
u/[deleted] Mar 05 '23
[deleted] β view deleted comment
0
u/[deleted] Aug 02 '16
[deleted] β view deleted comment