r/ObjectiveC • • Mar 15 '20
Objective-C in 2020 as a beginner
Hi! I am new to Apple platform, but not new with programming. I know python and some algorithms and data structures. Can I learn Objective-C as a beginner for iOS development or should I go with Swift? I saw that even Apple has now written the new documentation only in Swift. Can this be a bad thing for me?
Thank you for your time!
17
Upvotes
6
u/kechboy63 Mar 15 '20
I would start out with Swift if you’re new to the whole Apple thing.. I think it’s much easier to get to know the tools, the frameworks like Foundation and UIKit and also the language itself.
ObjC is a lower level language and you’ll have to learn how to work with pointers safely, learn what header files are and how to work with them and you’ll have to learn the language syntax, which is not always easy to follow and understand.
Swift is a much easier language to learn and understand: there’s lots of syntactic sugar that makes the code really easy to follow and it has really lifted the use of structs and enums - also contributing to the readability of the code. Also, because Swift is a higher level language, you’ll not have to deal with pointers or, in Swift’s case, unexpected null references.
Finally, Swift works really nicely with ObjC and the ObjC runtime so later, when you have much more knowledge about the frameworks, the runtime and unavoidably strong/weak references, you can always start experimenting with ObjC.
I started developing for iOS back in 2012, way before Swift was announced but in hindsight I wish I would’ve started later and with Swift. Don’t get me wrong, I love ObjC to death and it’s a very interesting language but she can be a bitch.
TL;DR: I’d start with Swift first and only try ObjC when you’re more than familiar with Apple’s tools and frameworks.
10
u/mantrap2 Mar 15 '20
It's definitely possible to do most everything done in Swift-based tutorials in ObjC also. There isn't a lot of documentation for it - that's true but I've slogged through that and been successful. It's a pretty big commitment however; certainly the "easy path" is "Swift" and "ioS only" development. That doesn't always fit what markets want or what makes sense in terms of software engineering.
ObjC is never bad because there's tons of legacy code in it. It's like how I still have economically viable knowledge of FORTRAN and BASIC - these are still used today and money can be had for that knowledge.
I like ObjC because it's a small jump from the C++ we use for Model layer code. We use C++ because we also use Qt a lot for cross-platform applications (we do B2B products primarily). I can't imagine getting boxed in with Swift on that back-end - it would be a major mistake. Strictly we could wrapper C++ in Swift but now you have two problems.
4
u/inscrutablemike Mar 15 '20
These days it's possible to do everything you want to do in Swift without touching Objective C. You *will* have to touch ObjC, eventually, and some things about programming for iOS and Mac won't make sense until you do, but being able to code in ObjC is no longer a gatekeeping requirement.
4
u/Evgeny_19 Mar 16 '20
I would like to recommend a great book "Effective Objective-C 2.0" by Matt Galloway. But yes, all modern examples are focused on Swift and there is also a new subset of building UI with SwiftUI. Swift is just unavoidable at this point. You can absolutely learn Objective-C today, but eventually you will have to learn Swift as well.
3
u/[deleted] Mar 15 '20
Unless you already have a compelling reason to go with Objective C, just go with Swift. It’s easier, more concise, and the leading programming language for iOS. Objective C is not a requirement for iOS development jobs. Knowing both will help though.
5
u/anthraxmilkshake Mar 15 '20
Unless you're specifically planning on working at a company that has a big legacy Objective C codebase like Facebook, you should learn Swift.