Nestia – Lifestyle Mobile Apps in Singapore

It has been more than 1 year since I last posted. I have been extremely busy with the projects of the new startup company (Singapore) that I joined more than 1 year ago. When I have free time, I just want to do things unrelated to work and have a good rest so that I can perform better when I am working. Thus, I haven’t update my website for quite a while.

For your information, I am currently working in the the startup company called Nestia as a Senior iOS Developer. Nestia is a startup company in Singapore. We started as a property rental startup company. But our business has grown to more than just the property sector. We are now a Home Living/Lifestyle startup company.

What is a Lifestyle Startup Company?

We are trying to provide all the needs/wants for the foreigners who come to Singapore to work or study.

They need to rent/buy an apartment, we develop the Property Rental and Sale listing web/apps for them. They need to know how to get around the Singapore, we develop the Interactive MRT map, the Bus Routes and Arrival Time, Direction from A to B and Get Off Alarm for them. They want to know what are the place of interest and also need help for cleaning their apartment. We have added the Home Services and Nearby in our app for their convenience.

Thus, If you are using the Nestia App. You will see some features such as the Property Rental/Sales, Transportations, Home Services, Nearby, Movies and more in our app.

If you are a iPhone user in Singapore. You may go to the iTunes Appstore on your mobile devices and go to Lifestyle category. You should see the Nestia iOS app rank within the Top 10 positions on the Lifestyle Category of Singapore App Store.

Nestia App Annie


From the App Annie, you can see that our app has been ranked consistently within the top 10 position in the Singapore Lifestyle on the iOS App store since early 2016.

My Responsibilities as the iOS Developer

Basically, there are 2 different apps that I developed in Nestia:-
1. Nestia Pro iOS App (Property publishing and management app for property agents)
2. Nestia User iOS App (The lifestyle app for common users)

Nestia Pro iOS App is the First app that I started to build because during that time, our web portal has just been launched. We have to develop an app for the property agents to manage the property listings. After the Nestia Pro app has the decent functionalities, we focus most of our time and energy on the Nestia user apps.

The initial stage of the Nestia user app contains only the messaging and the property listing functionality. Now, it has other additional features like Transportation and Home Services like I mentioned above.

In the First 10 months when I was working in Nestia, I was the only iOS developer for both the apps.

But now, there are 2 more iOS developers joining the iOS development team. It has been interesting to develop the apps in a team using Git version control. I have learned deeper into the Git by learning how to control the master branch in released stage, create new development branches, merge the branches, rebasing, solving the conflicts and etc. It has been a good learning experience.

I will only describe the features that I developed myself in the bottom post.

Nestia Pro (For Property Agents)

This is the app for the property agents. They use the app to add/edit/publish the property rental and sale listings. I will explain briefly on some of the features that I developed for this agent app:-

1. The property listing page (Rental and Sales)
2. The Property submissions page (Rental and Sales)
3. Co-broke (Rental)
4. Inbox (App messaging)

Nestia Pro
Nestia Pro
Nestia Pro


The property agent can register an account with us via our website or the app for Free. We have given the agents at least 6 months of free trial before they decide if they want to join us as paying members.

The agents can submit and view their listings via the app. The agent can even co-broke with other agents for any potential rental deals. In the co-broke feature, the agent can search for a property using place, condo or MRT station.

The agent can use our app to communicate with the potential tenants, buyers or other agents for the co-broking.

Nestia Pro
Nestia Pro
Nestia Pro


Nestia Lifestyle app – (For Common Users)

The early stage of the Nestia iOS app contains only the Property rental feature. Because the main targetted users of our app are the foreigners who are either working or studying in Singapore, as time passed by, we have added more features into the app to help them in their daily lifestyle.

We really care about the user experience of our products. Many of the touches, how and when to load info/photo, the navigation from 1 view to another view have been properly planned in a way to give the best experience for the users of our app.

NOTE: There are too many features on this app and I will only share the main features.

The Property Listing View
We want to make the First page of property listing as simple as possible. The vertical loading of the property list. When a user is going to the homepage of the property rental/sales, we have limited the loading to only 10 properties at a time (using the paging logic). This is to prevent the long waiting time. As for the property photo for each property, we only load 2 photos at the same time. Each swipe of the photo will only load 2 photos as well.

This type of small logics of loading is not easy to implement. We have implemented it because we know that it will improve the user experience.

Nestia User
Nestia User
Nestia User


The Property Map View
The clustering technology. There are many clustering technology and we find out that most of the clustering technology out there will have random generated clusters that always have random numbers for every single scroll and zoom level. We believe that user might be confused and might not be able to find the property that the user has previously seen.

So, we have implemented a clustering technology that based on different zoom level. Within a certain zoom levels and without changing the property filters, the number of properties inside that cluster will be static. It will ensure that the user is able to find back the same property inside the same cluster at the same location inside the map view itself.

Yet again. this type of clustering is not easy to implement because we have removed the randomness of the clustering. We have implemented it because we believe the users would prefer this type of clustering property search inside a map view.

To further simplify the property search on the mapview, we only limited the cluster to only 3 layers. Users know exactly what to expect after using our app for the first time. Most of the time, you will not know how many layers are there for the clustering on other apps as there could be unlimited layers.

The Location Search Filter
When a user is searching a location, there could be 3 different types of results:-
– A Place
– A Condo
– A MRT/LRT station.

These search results are not randomly selected, we did that because we believe it will provide a lot of convenience to the users of our app. After the user has selected a search result. The coordinate of that result be will compared further with the coordinates of the property to let the user know the distance between them. If you go to the static map of the property listing page, it will let you know the fastest route between these 2 locations (either via walking only or MRT + walking). Here, we actually are using the Google static map technology to compare 2 different locations.

Nestia User
Nestia User
Nestia User


Transportation
Transportation is second biggest module after the Property Rental and the Sales. It is to provide the convenience of the users who want to know how to get around Singapore. The main modules for the transportations are:-
– The MRT Interactive System Map
– The MRT Map
– The Bus Arrival Time
– Direction
– Get-off Alarm

The MRT Interactive System Map
Most of the app/website only have static MRT graphic map which give very little information. Our app has this MRT Interactive map which allow the users to choose 2 different stations. After choosing 2 stations, the map will show the closest route between 2 stations, the cost and the estimated time.

The MRT Map
This MRT Map is a more detailed map compare with the graphic map. It shows all the route of the MRT system in Singapore.

The map has 3 layers:-
Layer 1: Show all the MRT routes
Layer 2: Show all routes + MRT station
Layer 3: Show the routes + MRT stations and the station Exits

The user of our app can do some filtering using the station and the map will navigate to that station. It will also show the MRT schedule of that station.

Nestia User
Nestia User
Nestia User


The Bus Arrival Time
Land Transport Authority has done a great job by providing the open API for the bus arrival time. Not only that, I personally have been a frequent user of this particular feature of the app. I can assure you that the bus arrival time is accurate to the seconds. It helps me to plan my travel time properly.

Nestia User
Nestia User
Nestia User


Direction (from A to B)
Direction is the module used by our app users to get around Singapore. The users can enter the location A and B, then we will shows:-
– The Best Recommended Routes
– The Less walking Routes
– The Bus Only Routes

It is up to the users to choose which route is the best for him/her. For each of the routes, the app will also show the cost and the estimated time.

On the Direction map view, it shows the the walking route, the MRT stations, the MRT station Exists and also the bus routes.

The map and the table view may look simple but it is not easy to implement. It is difficult because there are so many ways to get the the same location. To prevent misleading, we need to show the right information to the users. The height of the table view cells will have to be determined in real time based on the information returned from the server. For example, some cell might has only 1 row but other cells might have 3 rows.

Nestia User
Nestia User
Nestia User


Final Notes on the Nestia iOS Apps

I couldn’t cover all the features that I developed for the Nestia app in this post. Here are some other features that I have developed.

The Get-off Alarm – When the user is riding a bus, he/she can set a bus stop to get off. The user can do other stuff, put the app in the background. When the bus is approaching the destination, it will sound the alarm to alert the user to get off from the bus. We are using the GPS and the background location technology.

Home Services – The current apps has 10 different home services: Aircon, Cleaning, Moving, Plumbing, Laundry, Electrical, Paint, Wallpaper, Locksmith and Pest-control.

Favourites – Users can add Property Rental, Sales, Home Services to the Favourites so that they can access the listing easier in the future.

Inbox – The user can communicate with the property agents or owner via the Nestia app. We are using Push Notification technology to notify the users when they have new messages. The current messaging system support the normal text message, the picture message and the property card message. In the future, there will be more message type when we allow the user to use the in-app messaging to communicate with the service provider.

Nearby – The user can use Nearby to find out the Place of Interest from his/her current location. For example, if a user is trying to find the nearest petrol station, with a few taps on the app, the petrol stations info will be available on the screen.

Property Details Page – On the property detail page itself not only has the info related to the property, we also include feature like Transport, Direction and Nearby. The user knows all the available transportations and place of interest near that particular property.

Nestia User
Nestia User
Nestia User


The above post is a summary of the apps that I developed when working in Nestia as a senior iOS developer, if you are interested to find out more about the apps, please download the apps and give them a try!

Download the apps from the Apple iTunes App Store:-
Nestia Pro iOS (For Property Agents)
Nestia iOS (For Users)

Getting Location Updates for iOS 7 and 8 when the App is Killed/Terminated/Suspended

This is a long awaited article that I promised to write. A couple months ago, I found a way to get the location update from iOS 7 and 8 even when the app is not active on foreground and not in the background. Yes, you may get the GPS coordinates from the iOS devices even when the app is killed/terminated either by the user or the iOS itself.

Apple does not communicate much with the developers on the ways to do that. If you remember this post from early 2014: Apple’s iOS 7.1 will fix a geolocation bug — after developer sends letter to Tim Cook. In iOS 7.0, Apple prevents the location update when the app is killed/terminated/suspended. But, Apple has fixed the “bug” starting from iOS 7.1 by allowing the app to get the location coordinates.

I have read the release notes for iOS 7.1 but I couldn’t find any information related to location updates and also the way to get the location when the mobile application is terminated/killed/suspended. The iOS 7.0 to iOS 7.1 API Differences for CoreLocation is stated as “No changes“. What?!

But, I didn’t give up in finding the solution. So for a few months, I used my free time to play a bit of the iOS APIs including the CoreLocation APIs. After many months of trials and errors, I finally found the solution.

I will provide the full solution, upload to the Github and write the detailed information on this post.

How to get Location Update for iOS 7 and 8 even When the App is Killed/Terminated

I have written an old article related to getting the continuous Background Location Updates for iOS 7 and iOS 8.

The method to get the location in the background continuously for iOS 7 and 8 is using the method “startUpdatingLocation

and then the next trick would be on the delegate method “didUpdateLocations“. You will have to use a timer and handle the Background Task appropriately. Any missing steps and the location will not be updated continuously.

But in the case of getting the location when the app is terminated/suspended, I can not use [myLocationManager startUpdatingLocation]; The only way to make it work is to use:-

Surprised. Surprised. Yes, I only figured that out after many trials and errors.

Another important trick is, you will have to know how to handle the key “UIApplicationLaunchOptionsLocationKey” on the app delegate “didFinishLaunchingWithOptions“. Here is the sample code:-

In addition to the didFinishLaunchingWithOptions method, I have created a locationManager Instance when the app is active. Here are some code examples:

What exactly is the LaunchOptions Key “UIApplicationLaunchOptionsLocationKey”?

UIApplicationLaunchOptionsLocationKey is very important to get the location update even when the app is neither active nor in the background.

If you read its description from the XCode, it says: “The presence of this key indicates that the app was launched in response to an incoming location event”. What does it mean?

You may realize that when your app is launched for the First time, the App Delegate method “didFinishLaunchingWithOptions” will run once. If you put your app into the background and then launch the app again from the background. This app delegate method will not run again.

The method will only run again after you killed/terminated the app by swiping up from the App Preview Screen and then relaunch from where your app is located.

If your app is a location based mobile application and you need the user’s location even the app is terminated/suspended, then there is another way to launch the app without the user interaction. The iOS will launch the app for you.

When your app delegate methods LaunchOptions contains the key UIApplicationLaunchOptionsLocationKey, it means that your app is launched by the iOS because there is a significant location changes. So, you will have to do something with the new location GPS coordinates return from the location manager.

If order to do so, you will have to create a new instance of location manager and you shall get the location coordinates from the method “didUpdateLocations“.

How Frequent is the Location Updates?

As per Developer Documentation: Core Location Documentation.

Apps can expect a notification as soon as the device moves 500 meters or more from its previous notification. It should not expect notifications more frequently than once every five minutes. If the device is able to retrieve data from the network, the location manager is much more likely to deliver notifications in a timely manner.

So, you could only expect the location update if the device moves over 500 meters and at most once in every 5 minutes.

From my own testing (I am driving around a lot! To test the Core Locaton API), I only get the location update about every 10 minutes.

Full Source Code for the Location Updates Even when the iOS mobile apps is Suspended/Terminated/Killed

In this source code, I have included the methods to save the location GPS coordinates into a PList file. The purpose of saving into a PList is to record the location coordinates, the iOS Application States and the way locationManager is created (Add From Resume or otherwise).

Here are some simple instructions on how to test this solution:-

1. Download the project from Git Hub.
2. Change to your own Bundle Identifier (If need to)
3. Connect your iPhone with your mac.
4. Launch the app into your iPhone.
5. Killed the app. (Double tap and remove the app from the App Preview)
6. Travel around with your iPhone for a few days.
7. Download iFunBox for Mac or any alternative that allows you to open the app and Read the PList from the “Documents” folder.
8. From the PLIst, you will see something like the screen shot below:-
Getting Location Even When the App is Suspended/Killed/Terminated

When you see the key “UIApplicationLaunchOptionsLocationKey” under “Resume“, it means that the iOS has relaunched the app after the devices has moving significantly from the last known location. If you create a new location Manager instance, you will get new location from delegate method “didUpdateLocations“.

Source Code: GitHub Source Code for Getting Location Updates for iOS 7 and 8 when the App is Killed/Terminated/Suspended

Learning Unit Testing in XCode 5

I have been delaying in learning Unit Testing ever since the released of XCode 5 on September 2013. It is partly due to my busy schedule in rushing 2 complex projects back to back. Now the Second project – Watch Over Me 3.0 is under the beta testing stage, so, I have some time to pick up some skills that I have been wanting to learn.

What is Unit Testing?

Unit Testing is part of Agile Software Development Methodology to make the entire software development process more efficient, the development project to be easier to maintain, less crashes on deployed software and higher quality of code.

Automatic Unit testing, on the other hand, is a proactive way to test a small unit of codes (functions, classes) from time to time to make sure that they are always ready for production. You can host a test server (eg: OS X Server) together with Git repository server. On the test server, some bots will test the latest commits of the codes frequently.

Unit Testing in XCode 5

Apple has done a great job by providing us (The iOS developer) with good framework that can help us to implement unit testing easier on XCode 5. I have learned this unit testing through WWDC 2013 video – Testing in Xcode 5 by Mike Swingler.

From what I learned from the video, we all should start the Unit Testing from Model and Controller. XCode 5 has been designed to make the Testing between the Model and Controller really easy. The new framework for the testing is XCTest.framework. This framework is derived from OCUnit. The iOS developers have been using OCUnit framework prior to XCode5. So, the previous testing codes are compatible with XCTest framework. If you were using OCUnit, you only have to refactor your old code to make it running well with the new framework.

While I was trying to implement the Unit Testing on my old personal Calculator XCode project, I found this simple tutorial (CS305 Software Engineering – Unit Testing in iOS). It shows me some steps and codes using a different calculator project. I learned something new from it.

Be warned, this project is old and it is definitely not optimized for iOS 7.

Example of Unit Testing in Calculator App

I just implemented what I have learned from the video on an old Calculator app project that I have developed for fun some time ago. This is not a usual calculator that most people are familiar. This is a RPN (Reverse Polish notation) calculator.

For example, if you would like to calculate an operation such as 21 + 63, the steps that you have to follow are:-
1. Press 2 and 1
2. Press Enter
3. Press 6 and 3
4. Press Enter
5. Press +
6. Press Enter

You will then get the result showed like the screen below:-
Unit Testing on XCode 5 With Example Project

Unit Testing can be further divided into 2 parts:
1. Logic Unit Testing
– Test only the logic with fixed values and without human interaction
2. Application Unit Testing
– Simulate the user inputs by using user interface such as button and make sure that the app behaves the way it should.

To keep make thing simple, I will only implement Logic Unit Testing for now. I will add more examples when I learn deeper into this Unit Testing.

The Model of my calculator project is CalculatorBrain. It has 3 functions:-
1. pushOperand
2. performOperation
3. popOperand

So, I will perform the unit testing on these functions.

There are only 4 major operations:-
1. Addition (+)
2. Subtraction (-)
3. Production (*)
4. Division (/)

I will implement Logic Unit Testing for all these 4 operations but I will only show an example in this article.

When a user is trying to add 21 with 63, he/she should get the result as 84. Or else, this operation will fail. Here are the steps:-

1. I import CalculatorBrain.h into CalculatorTests.m.
2. I create an instance of CalculatorBrain and instantiate it in setUp method.
3. I create a method calls testAddition.
4. I push 2 numbers (21, 63) using pushOperand.
5. Then, I use performOperation to calculate the result.
6. Lastly, I compare the result with 84 using XCTAssertTrue.

If the logic testing is good, it will show you the following result on the command line:-

If the logic testing is wrong, it will show you something like:

You then will know that you have made a mistake somewhere in the code, you will have to find a way to fix it.

The screen below shows you the complete unit testing for all the 4 operations.
iOS Unit Testing by Example XCode 5

Final Thought

Unit Testing is really an interesting way that helps us to be more proactive in programming. This is especially true when we are able to implement the Bots that help us in testing the project automatically.

You can find the full source code for this simple Unit Testing that I uploaded to Github here: iOS Unit Testing By Using Calculator Project on XCode 5.

Enjoy!