Swift Programming: Basic ideas Xcode of Swift

Swift Programming Basic ideas Xcode of Swift
Swift Programming Basic ideas Xcode of Swift

Basic ideas Xcode of Swift: Objective-C is a native programming language for iOS and OSX operating systems. It is a compiled language. That is, the entire code is compiled first and then builds and runs from there. Objective-C has been created in C programming language with object-oriented features. The syntax of Objective-C is considered to be more human-readable than that of C.

The comparatively simple syntax of this language is further contributed by some of the more extensive libraries. Although it is not mandatory to know about those libraries now from the point of view of language learning, it is better to have some ideas. Apple’s Cocoa and Cocoa Touch frameworks are well known in many libraries. They define some APIs, making it easier to build applications for OSX and iOS, respectively. Some frameworks like Foundation, UIKit, AppKit, CoreData QuartzCore, AVFoundation. After becoming familiar with Objective-C, the tools discussed above are the essential things in building an app for iOS and OSX. For now, we can only use the Foundation Framework to deal with this language.

Xcode: Basic ideas Xcode of Swift

Although there are many other ways to compile Objective-C code, we will use Xcode from the beginning in this series because it is our intention to develop iOS, OSX App by the end and it is definitely useful to get acquainted with Xcode. Xcode is an IDE of Apple (Integrated Development Environment). It also has a code editor, debugger tool, app’s GU interface builder and simulator.

Screen Shot 2014-05-05 at 5.34.53 PM
Next Click
Screen Shot 2014-05-05 at 5.35.32 PM
Next Click

Creating Apps / Environment Suitable for Objective-C Practice:

Xcode can provide us with a variety of templates to help you create iOS and OSX apps. For the sake of our series of tutorials, we will use the Command Line Tool type app template. By doing this we can stay away from all the other tools for creating iOS / OSX apps and just build whatever environment we need to learn about Objective-C. Xcode’s File-> New-> Project at the bottom of the window.

The pass from the left OSX: Application Command Line Tool to select the right pass the bottom of another window, select Next. Here some basic settings of the app are configured. What you can give to Product Name and Organization Name and edu.self to Company Identifier can be used as a private use identifier, if you do not have a unique reverse domain. Select Foundation from the Type field because we will get to use several classes defined in this framework in the future. Now click Next to show the project shave location.

Screen Shot 2014-05-05 at 5.36.09 PM
Create Click

After clicking on the Create button in the left-hand navigator of Xcode you will see some more file folders, including the main.m file. This main.m file is important for now. This is because iOS, OSX and even Command Line Tool type apps start running from here 🙂 And yes, .m is the extension of the source file of Objective-C.

main () event:

As mentioned earlier, the main () function acts as the root of any Objective-C app. Xcode creates a main.m file for almost all app templates where a main () function is defined. When you open the file, you will see the following code:

#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]){
    @autoreleasepool {
        // insert code here...        NSLog(@"Hello, World!");
    }    return 0;}

In the @autoreleasepool block we will write all our practice codes. @autoreleasepool is one way to prevent memory leaks. Although it is different from the main topic of our tutorial series, you can learn about it here. Apple Document“The @autoreleasepool statement is there to support memory management for your app. Automatic Reference Counting (ARC) makes memory management straightforward by getting the compiler to do the work of keeping track of who owns an object; @autoreleasepool is part of the memory management infrastructure. “


with the exception of @autoreleasepool, it can be said that the main () function simply calls a global function called NSLog (), which is defined in the Foundation framework. It is used to print messages on the Xcode console. Objective-C string type values ​​are defined using the @ symbol at the beginning, which is sent as a parameter of NSLog ().

Screen Shot 2014-05-05 at 6.00.24 PM

Editor’s Xcode app purchase made by pressing Command + R area can be seen in the debug console messages like the following. In this tutorial series, we main.m the Objective-C language features to edit the file will Tests.

But in reality, you don’t need to touch this file while creating iOS / OSX app. Because, if you create another type of app template with Xcode, you will see that the control of the whole program is being given to the Application Delegate by creating the application object and app delegate instance in the main () function and this is the end of the main () work. So, the thing is, it’s not a matter of research right now. For now, we will test the feature of Objective-C as a language, not app development.

The next post will discuss basic syntax, variables, conditions, loops, macros, data structures.

Note: More Info (Tech24InfoBD) (Basic ideas Xcode of Swift)


Please enter your comment!
Please enter your name here