I felt that I had enough knowledge to start building apps so I decided to copy some popular apps with interesting mechanisms. The idea is to do one every week or two, so that I can build a lot of these apps and learn how they are built.
Why build lots of apps?
Part of my inspiration has been Ira Glass’s notes on storytelling where he walks about beginners needing to do a great volume of work before they can make things that they think are good enough. I’m starting that journey now.
Why reverse engineer apps and not build original apps?
When artists learn to paint, they copy other artists to learn how something is done. In app making, I’m doing the same by analyzing and appreciating how other developers have made their apps.
Project 1 is Tinder.
The interesting mechanism here is the swipe left or right to like or dislike.
Step 1 Break down the app into views



For my first iteration, I really just want the settings and the match page to work. The messages would be part of the second iteration and moments would be part of the third.
Step 2. Take the views and make the data model
I started by translating the Settings and Match views into classes and properties, leaving the methods fluid for now.
There needs to be a Person class.

The Facebook properties would be imported with Facebook authentication and the rest would be set by the customer.
For simplicity, I have the location as a NSString now.
When I thought about how the custom initializer would work, I realized that I would probably need to split this class up into small modules with Discovery Properties, and Facebook Properties as classes.
I realized that I would also need a way to match people. It made more sense to make a Matcher class because I would want a central place to store data and review the results (whether people liked each other) to see how well my matching algorithm was working.

Naturally, the array of matches would need a match object, so I wrote a match class.

Step 3. Make the basic interface in storyboard
Tinder has four pages but I just wanted to mock up the Settings, Match and Messages pages.
Specifications:
- Slides horizontally from page to page with Settings, Match, and Messages page from left to right.
- Starts on the Match Page
1st Iteration
Test: I tried three UIViewControllers with buttons on navigation bars that went between the three pages.
- Select the storyboard or make one (File > New > File Cmd-N, iOS > User Interface > Storyboard)
- Add three View Controllers from the bottom of the Utilities column (right sidebar).
- Add a navigation bar to each of the three view controllers.
- Add bar button items to each screen as shown below.
- Add segues for the bar buttons to the adjacent screens.

Results: As I found out after running this, the transitions make the new screen pop up from the bottom like a modal window.
- Slides horizontally from page to page with Settings, Match, and Messages page from left to right.
- Starts on the Match Page
2nd Iteration
Test: Use a navigation controller.
I have a navigation controller with the root controller as the Settings page with the Match page and the Messages Page linked to that.

Results: The transitions are now horizontal between pages. It’s not smooth like Tinder’s touch gestures, but it’s close. The app doesn’t start on the match page though if I want the sliding to work in this order.
- Slides horizontally from page to page with Settings, Match, and Messages page from left to right.
- Starts on the Match Page
3rd Iteration
Test: Make the Match page the root view controller and add a link back to the settings page.

Results: After clicking the settings button, the transition slid from right to left and the Settings pages looks just like the messages page. Not what I wanted.
- Slides horizontally from page to page with Settings, Match, and Messages page from left to right.
- Starts on the Match Page
4th Iteration
Test: I’m guessing that the transition is either a customer segue or there’s something about gestures that I don’t know. I’m going to look into gestures between views.
As I looked through the gestures, I noticed the Page View Controller. After googling it and finding this AppCoda tutorial, the scroll transition looks exactly like what Tinder uses.
5th Iteration
A Page View Controller is a container controller that you put other view controllers inside.
So, I’m going to need to make three classes of view controllers that show the Settings, Match and Messages pages. Then, I’ll put them inside the page view controller.
Looking through the PageViewDemo from the AppCoda tutorial, I see that they have one view controller that creates a pageViewController, provides the data for the pageViewController and sets an array of PageContentViewControllers in the pageViewController.
Sidebar: Navigation Bar vs. Navigation Item
When I was using the Navigation Controller, I needed to add navigation items to the Settings, Match and Message view controllers to be able to add a title to each slide.
When I deleted the Navigation Controller, I made the navigation bar disappear. While the navigation item was still there, it was useless without the navigation bar, so I had to add three navigation bars onto the Settings, Match and Message view controllers.
Where a navigation controller exists, add navigation items. Where there is not , add navigation bars.
Test: In order to implement the pageViewController, I added a ViewController class inheriting from UIViewController and added a PageViewController, a SettingsViewController, MatchViewController, and MessagesViewController into the properties. The last three are custom classes inheriting from UIViewController.

I created the five view controllers in the Storyboard and added their class name to each corresponding storyboard ID.

Then I set the properties in ViewController.m to each of the storyboard IDs.

Here I set the match view controller to be the starting one.
- Slides horizontally from page to page with Settings, Match, and Messages page from left to right.
- Starts on the Match Page
Now it starts with the match page, but doesn’t have any other other pages. The Settings and Messages pages are there, but they are not connected yet.
I see that the PageViewDemo has two methods called
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
and
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
That’s probably what I want to tell the page view controller how to switch between the Settings, Match and Messages view controllers.
When I try to type those in, they were not autocompleting, which means that I was missing something. I think it’s because I haven’t set the ViewController to follow the pageViewControllerDataSource Protocol. After I add that to the ViewController.h file. I get a warning. Yes!!

Now I understand why the PageViewDemo had
self.pageViewController.dataSource = self;
in the viewDidLoad.
Since I only had three pages, I wrote two simple if statement for the viewControllerBefore and viewControllerAfter methods and everything works.
- Slides horizontally from page to page with Settings, Match, and Messages page from left to right.
- Starts on the Match Page