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
directoryThe
AppDelegate
class and theBalanceItem
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 theKiiObject
in Kii Balance.The
KiiBalance/Title
directoryThis 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
directoryThis directory includes the classes for the data listing screen.
The data listing screen is implemented with the
BalanceListViewController
class. This class implements theUITableViewDelegate
protocol and theUITableViewDataSource
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 theBalanceItemTableViewCell
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. TheDoneEditDelegate
protocol updates the list with the edited income and expense data.The
KiiBalance/Alert
directoryThis directory contains utility classes that are shared across the program.
This directory includes the
KiiAlert
class for displaying an alert and theKiiProgress
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.