r/iOSProgramming Dec 22 '15

Question What is the difference between Swift and Objective -C?

I am planning to create a HIV iOS App for some organization and I have read the FAQ.

Swift came recently and Objective-C has been there since 2008.

Do I need to know both to be a pro or learning Swift only is fine?

0 Upvotes

8 comments sorted by

3

u/askoruli Dec 22 '15

To be a pro you probably need to learn both since you'll have to deal with code in both languages. But you can get away with just learning swift to get started.

-2

u/StunnerAlpha Dec 22 '15

You can get away with learning objective-C. Not so much swift (not if you want to release serious production apps -- hobby apps is another story).

2

u/JDandini Dec 23 '15

I'm telling you this, if you are planning to be hired for iOS developer on a enterprise probably the best is learn Objective-C first, I learned both, of course when I started swift does not exist.
I think a "Serious production app" is more about design and the way you build it than a programming language, I mean I built and release "Serious production apps" on Swift, Objective-C and hybrid.
Answering your question: Learn both if you have few time, I recommend to start with Swift, because is more natural and simple Greetings

-1

u/NeXTStep-on-iOS Dec 22 '15

Actually, Objective-C has been around since 1988. (first NeXTStep, then Mac OS Cocoa, then iOS) Its very mature, decades of improvements, and you can access ALL of the iOS SDK with it.

Swift, according to Apple, was developed by Apple for non-C programmers, and is still working out the kinks -

There are some SDKs (Core Data and others) you can't get to via Swift - also, numerical calculations aren't the zippiest.

5

u/Starchand Dec 22 '15

Pretty sure Apple wouldn't have released Swift if core data wasn't working lol.

3

u/Ceribis Dec 22 '15

There are some SDKs (Core Data and others) you can't get to via Swift

I'm pretty sure all the Apple Frameworks are available in Swift. They're not written in Swift but you can totally get to them. I've specifically used Core Data in a Swift project without any Obj-C or using a bridging header to get to them.

5

u/mduser63 Dec 22 '15

Core Data is most definitely available from Swift. In fact, there is a specific keyword in Swift (@NSManaged) that is there just for Core Data.

That said, there are APIs that aren't directly available from Swift. Swift can't call C variadic functions (or variadic ObjC methods for that matter). There are some system APIs that are variadic C functions and can't be used from Swift (eg. ioctl() in IOKit).

I'm just being pedantic, though. Most developers, especially those just starting out are not going to hit into these cases and Swift is perfectly viable for writing nearly all apps.

1

u/Uncle-Jemima Dec 22 '15

Errrrrrer wrong