DEV Community

Arhan Khan
Arhan Khan

Posted on

Objective-C for Beginners: The Language That Built the iPhone Era

Before Swift, every iPhone app was written in Objective-C. It is a thin layer on top of C that adds objects, message passing, and the frameworks that still power macOS and iOS today. You will not start a new app in Objective-C in 2026, but you will meet it constantly: in old codebases, in Apple's own frameworks, and in any job that maintains an app written before 2014.

Objective-C looks strange at first because method calls use square brackets and named parameters. Here is a tiny example:

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSString *name = @"Arhan";
        NSLog(@"Hello, %@! You are learning Objective-C.", name);
    }
    return 0;
}
Enter fullscreen mode Exit fullscreen mode

NSString is a string object, %@ prints an object, and NSLog writes to the console. The @ symbol marks Objective-C additions to C: @"" for strings, @[] for arrays, @{} for dictionaries. Once you see the pattern, the syntax stops looking alien.

Objective-C is worth learning because it teaches you the runtime that Swift still sits on top of. Message passing — sending a message to an object instead of calling a function — means an object can decide at runtime how to respond, or even forward a message it does not understand. That dynamic behaviour is why Cocoa frameworks are so flexible, and why understanding Objective-C makes you a better Swift developer too.

How to start: on a Mac, open Xcode, create a command-line tool project, and run the program above. On Linux, install GNUstep, which provides the Foundation framework outside Apple. Your first project: a small command-line tool that reads names from a file and prints a greeting for each one. After that, try building a tiny macOS app with a button and a label.

Who is it for? iOS and macOS developers maintaining older apps, students learning how Apple's platforms work, and anyone who wants to understand the runtime beneath Swift. If you are starting iOS development from scratch today, learn Swift first — but keep Objective-C on your list, because the old code is not going away.

The limits are honest: Objective-C is verbose, its syntax is unusual, and Apple has moved on — new tutorials, libraries, and jobs mostly use Swift. Treat it as a legacy and depth language: learn it to read, maintain, and understand, not as your first choice for a new project.

Your first step today: in Xcode or GNUstep, compile the greeting program above and run it. Then change the message, add a second name, and print both. You have just written code in the language that built the App Store — and that history is still running on millions of phones.

Top comments (0)