Class Structure

Kii Balance is designed using the following class structure. The same class names and structure are used in both Swift and Objective-C versions while only the Objective-C version has the main.c file that is omitted in the figure.

The classes with the stereotype <<iOS>> belong to the iOS SDK, the protocols with <<iOS, Protocol>> are iOS SDK protocols, and the class with <<Kii>> belongs to the Kii Cloud SDK. The classes whose background is pale blue are implemented in Kii Balance.

Each class corresponds to one of the screens of the user interface as shown in the figure below.

The classes are included in the directories below:

  • The KiiBalance directory

    The AppDelegate class and the BalanceItem class are in this directory.

    The AppDelegate class is based on the template generated by Xcode and includes the methods for initialization of the Kii Cloud SDK and screen transitions.

    The BalanceItem class defines symbols such as field names in the KiiObject in Kii Balance.

  • The KiiBalance/Title directory

    This directory includes the classes for the title screen. The title screen is implemented with the TitleViewController class and configured to be displayed as the first screen in the storyboard.

    Tapping the "Login" button on the title screen displays the login screen implemented with the LoginViewController class.

    Tapping the "Register" button on the title screen displays the user registration screen implemented with the RegisterViewController class.

  • The KiiBalance/List directory

    This directory includes the classes for the data listing screen.

    The data listing screen is implemented with the BalanceListViewController class. This class implements the UITableViewDelegate protocol and the UITableViewDataSource protocol and provides a user interface using a table view.

    The "Balance" row at the top of the table view is processed with a cell of the TotalAmountTableViewCell class. The list of income and expense items under the "Balance" row is processed with cells of the BalanceItemTableViewCell class.

    When the "Add" button in the upper right of the screen or a cell in the table is tapped, the screen for adding or editing an entry is displayed.

    The screen for adding or editing an entry is implemented with the EditItemViewController class. The Kii Cloud SDK adds, updates, and deletes data. The DoneEditDelegate protocol updates the list with the edited income and expense data.

  • The KiiBalance/Alert directory

    This directory contains utility classes that are shared across the program.

    This directory includes the KiiAlert class for displaying an alert and the KiiProgress class for indicating the progress of a task.

Key points for implementation of mobile apps are explained later in this tutorial. For the other parts, analyze the source code by using this topic as a reference.


What's Next?

Let us review the implementation of the AppDelegate class.

Go to Implementation of the AppDelegate Class.