OBJECTIVE – C

by Kamya Oberoi


Posted on 11/16/16 12:34 PM



A language that powers iPhone, iPad, and MAC apps…

Designed by Tom Love & Brad Cox, Objective-C marked its first appearance in 1984 i.e. 32 years back. It is a language used by Apple to create iOS and Mac applications. It aids people to write cleaner, more modular, and clearly separated code. So sit back and enjoy your journey into the world of Objective – C!

Before moving ahead, I hereby assume that you are already aware of what is a computer program? what is computer programming language? and so on.

What is Objective-C?
A general purpose, object oriented programming language influenced by C and Smalltalk. Prior to the introduction of Swift, Objective-C was the main programming language used in iOS, OS X as well as respective APIs, Cocoa and Cocoa Touch. It offers cross-platform support with the current/stable release of v2.0. Included file extensions can be .h, .m, .mm, or .C.

Now, let’s touch some code in Objective -C and write our first program!
#import <Foundation/Foundation.h>
int main()
{
/* my first program in Objective-C */
NSLog(@”Hello, World! \n”);
return 0;
}

EXPLANATION: The #import <Foundation/Foundation.h> is the first line of every Objective-C program structure. It refers to preprocessor command, which tells its compiler to include Foundation.h file before moving to actual compilation. int main() begins the main execution of the program. ‘{‘ & ‘}’ are starting and ending braces of the program. /*…*/ are ignored since these are additional comments for adding any meaning to the program. NSLog(…) is a function that causes any inside the parameter to be displayed on the screen. And, return 0; terminates the main function and returns the value 0.

Getting started!
To set up your Objective – C environment, all you need is two software available on your computer:
1. Text Editor
2. GCD Compiler

Text Editor will include Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi. GCD compiler will be used to compile your source code into resulting executable program.

For installing Objective – C on Windows, Mac, Unix/Linux, please refer the below link :
https://www.tutorialspoint.com/objective_c/objective_c_environment_setup.htm

If you really want to explore more of Objective – C (and why not? It wonderful after all…), Try the following links:
http://tryobjectivec.codeschool.com/
https://en.wikipedia.org/wiki/Objective-C
https://www.tutorialspoint.com/objective_c/objective_c_quick_guide.htm

If you’re an iOS developer, you will still need to know Objective – C though Swift is a major step forward in this area.”

You just can’t do everything in Swift;

Whole community talks in Objective-C;

Frameworks are written in Objective-C;

Objective-C is really simple. It requires programmers to be explicit.

To sum up, Learn Objective-C and you’ll get to know ‘Swift’ very easily. That’s all Guys. Stay tuned, stay electrified. Cheerio:)

One thought on “OBJECTIVE – C”

Leave a Reply

Your email address will not be published. Required fields are marked *