Sie sind auf Seite 1von 3

Lalamove Test

Code Repository:

BitBucket repo link: ​https://bitbucket.org/binojvj96/dlist

Project Information:

1. Project Dependencies:
a. Cocoapod v1.0.1
b. Node.js ver. 4+ [For running the mock api]

2. Instruction to run the project:


a. Install pods:
Go to the folder containing “​Podfile​” inside the project repo in terminal and run
command “​pod install​”. Open “​DList.xcworkspace​”.
b. Start Mock Api:
Go to “​Mock Api​” folder inside the project repo in terminal and run command “​npm
start​”.
c. Change the ip address in “​ApiManager​” class:
“​Constants​” struct in “​ApiManager​” class has the “​Domain​” for the mock api. Use
“​localhost​” if you are running in simulator or use the “​ip address​” of the machine
where mock api is running if you are running the project in a device.

Note:​ ​The UI won’t be optimised if you are using the simulator. App won’t be able to
recognize the device and make the UI adjustments if it’s a simulator.

3. Libraries Used:
a. Alamofire (4.4.x)
b. Kingfisher (3.5.x)
c. ObjectMapper (2.2.x)
d. PromiseKit (4.1.x)
e. PureLayout (3.0.x)
4. Controllers:
a. MainNavigationController:
Navigation controller for all the view controllers. Navigation bar titles and all the
navigation bar buttons and actions associated to the buttons are handled from
here. UI orientation for the app is also controlled from here.

b. HomeViewController:
All the delivery items are listed here. This controller will fetch all the delivery data
on the first launch and store them in plist for offline access. Every other launch will
use the locally stored data. User can use the refresh button in the navigation bar to
fetch the data again. Newly fetched data will replace the stored data in plist.

c. DetailViewController:
Displays the details of the delivery item user selected from list. User can see a
map with which will display a pin to indicate the address of delivery. The
description of the item and an image will be displayed at the bottom of the
controller. This controller is shown as a pop-up.

5. Data Models:
a. DeliveryItem:
Stores the information about one delivery item. It is an NSObject class object
which conforms to NSCoding to enable storing in plist after archiving as NSData.

b. DLError:
DLError subclasses the NSError class and adds few more properties to support
just passing the error around and show the alert from the info available in the error
itself. ErrorManager class initiates DLError based on the error codes.

6. Managers:
a. DataManager:
DataManager handles all the read and write of the delivery items list to the plist file
for offline use.

b. ApiManager:
ApiManager handles all the api calls.
c. ThemeManager:
ThemeManager handles all the styling of UI items in the project. There’s different
Theme classes for iPhone and iPads which conforms to the Theme protocol which
declares all the styling methods. ThemeManager will decide based on the device
family, which theme to use.

d. ErrorManager:
ErrorManager class has methods which accepts the error codes from ApiManager
class and it creates a DLError object based on the predefined error codes available
in the class.

e. AlertManager:
AlertManager shows the alert view and it takes the information for the alert from
the DLError object passed in method call. AlertManager can be extended to take
other objects as well and show alert based on those objects.

7. Helper Utility Classes:

a. UIDeviceExtension:
UIDeviceExtension helps to identify the device family and adjust the UI based on
that.

b. UIColorExtension:
UIColorExtension adds methods to accept hex values of the color instead of rgb.

c. UIViewExtention:
UIViewExtention makes it easier to check if the device is in landscape.

d. LoadingScreen:
Reusable loading view which accepts a view as parameter in show() method and
adds itself as subview to that view. LoadingScreen dims the background and
shows a an activity indicator.

Das könnte Ihnen auch gefallen