Objective-C (programminglanguage) | |
---|---|
Full Name | Objective-C |
Short Name | Objective-C |
Description | Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language |
Company | Apple |
Web | No |
Mobile | Yes |
Enterprise | Yes |
Embedded | No |
Objective-C is a programming language that was developed in the 1980s and is commonly used for developing software for macOS and iOS. It is a strict superset of C, meaning that any valid C code is also valid Objective-C code.
Objective-C includes features such as dynamic binding, message passing, and protocols, which allow for flexible and dynamic object-oriented programming. It also includes support for categories, which allow for adding functionality to existing classes, and blocks, which are similar to anonymous functions.
Objective-C and Swift are two different programming languages that are used for developing software for macOS and iOS. Objective-C is an older language that has been used for many years, while Swift is a newer language that was introduced by Apple in 2014. Swift is designed to be easier to learn and use than Objective-C, and includes features such as type inference and optionals that make it safer and more expressive.
Objective-C is commonly used in iOS development to create native apps for iPhones, iPads, and other iOS devices. It is used to write the code that controls the user interface, interacts with the device's hardware, and communicates with external APIs and databases.
Some popular Objective-C frameworks and libraries for iOS development include UIKit, Core Data, and Cocoa Touch.
Yes, Objective-C code can be used in Swift projects using bridging headers. This allows for interoperability between Objective-C and Swift code, which is useful for developers who are migrating from Objective-C to Swift or who are working on projects that include both languages.
Objective-C is still relevant today, particularly for developers who are maintaining legacy code or who are working on macOS and iOS projects that were developed using Objective-C. However, Swift is increasingly becoming the preferred language for new iOS and macOS projects, as it is easier to learn and use than Objective-C and includes many modern language features.
Objective-C is a high-level general-purpose, object-oriented programming language that adds Smalltalk-style message passing (messaging) to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its NeXTSTEP operating system. Due to Apple macOS’s direct lineage from NeXTSTEP, Objective-C was the standard language used, supported, and promoted by Apple for developing macOS and iOS applications (via their respective application programming interfaces (APIs), Cocoa and Cocoa Touch) from 1997, when Apple purchased NeXT until the introduction of the Swift language in 2014.
Objective-C programs developed for non-Apple operating systems or that are not dependent on Apple's APIs may also be compiled for any platform supported by GNU GNU Compiler Collection (GCC) or LLVM/Clang.
Objective-C source code 'messaging/implementation' program files usually have
.m
filename extensions, while Objective-C 'header/interface' files have.h
extensions, the same as C header files. Objective-C++ files are denoted with a.mm
file extension.
Objective-C builds on the foundations of ANSI C. Compared to other object-oriented languages based on C, Objective-C is very dynamic. Dynamism enables the construction of sophisticated development tools. Since Objective-C incorporates C, one gets all the benefits of C when working within Objective-C.
#import <stdio.h> int main (int argc, const char *argv[]) { printf ("Hello, world!\n"); return 0; }
Source: Wikibooks
See also: Programming Languages