Source Code Structure

We will now start exploring the source codes of Hello Kii in depth.

The following figure illustrates the source code structure. The Swift and Objective-C versions basically share the same structure. The file extension for Swift is .swift and that for Objective-C is .h according to the language specifications.

  • main.m

    This file defines the main function of the mobile app. This file is required for Objective-C only. You do not need to modify or make reference to this file in this tutorial.

  • AppDelegate

    This is a class to process events for the entire mobile app. Initialization of the Kii Cloud SDK has been added to the code generated by Xcode.

  • LoginViewController

    This is an implementation of the login screen. It inherits the UIViewController class. It is configured to be displayed in the storyboard at startup.

  • MainViewController

    This is an implementation of the data listing screen. It inherits the UIViewController class.

  • UIViewController+Alert

    This is a class to add a function to display messages to the UIViewController class by the Extensions feature of Swift and the Categories feature of Objective-C. This enables to display messages that include error details by calling the showMessage(_:error:) method from the LoginViewController class and the MainViewController class. See below for examples of the caller.

    • self.showMessage("Login failed", error: error as NSError?)
    • [self showMessage:@"Login failed", error:error];

What's next?

We will explain how to initialize the Kii Cloud SDK in the AppDelegate class.

Go to Implementation of the AppDelegate Class.