Objective-C is a general-purpose, high-level programming language. Created in 1984, it was the primary language for the NeXTSTEP operating system. Following Apple's purchase of NeXT, it became the primary language for writing apps for macOS and iOS. Apple created the Swift programming language as its replacement in 2014, but it is still widely used by developers on those platforms.
Objective-C is an extension of the C programming language, adding object-oriented programming features. It uses nearly identical syntax to C for all non-object-oriented operations, like assigning variables and declaring functions. However, its object-oriented features borrow syntax from another programming language called Smalltalk. This syntax has objects communicate with each other by sending messages. Instead of calling on a predetermined method directly, as in other languages, the object instance that receives a message determines which method to use dynamically at runtime.
For example, a message from one object to another in Objective‑C looks like this:
This code snippet sends a message to the object named myObject, telling it to perform a method called sayHello. If the class that myObject belongs to includes a method named sayHello, it runs that method. Otherwise, the app checks the superclass that contains myObject's class, going further up the hierarchy until it finds the method. Other programming languages, like C++ or Java, bind methods to objects at compile time — making the program faster since it already knows what method to run, at the cost of making it less flexible.
Objective‑C does not include a standard library in the way that C++ does. Instead, all Objective‑C apps use one of several software frameworks containing default functions and code. For example, apps developed for macOS use the Cocoa framework, included in the Xcode SDK.