All things iOS & Swift

Working with Parse & Swift 2.0

Download the complete project file. | Download

Parse is a back-end provider for you app or any other platform, it’s the best solution for you online & offline back-ends.

Let’s get started, create a Parse account. You can sign up at using your Facebook, Github, or Google+ account, or by email.

Go to and click Create a New App.

Screen Shot 2015-09-04 at 8.14.08 AM

Name your app Paws and hit create.

In the Core tab from top, click the Add Class button.

Screen Shot 2015-09-04 at 8.18.27 AM

dropdown box should remain Custom. Click Create Class and now you have an online storage, Data is stored as objects. Click this Screen Shot 2015-09-04 at 8.42.50 AM+col.

Now create these fields with their data types.

  • name: String
  • votes: Number
  • url: String
  • cc_by: String

After everything is added, download this file and click import as shown in the image below. Select the file you downloaded, make sure the collection type “Custom” is selected.

Screen Shot 2015-09-04 at 8.44.33 AM

After importing and everything went well, your table should look like this. Filled with 10 cat names.

Screen Shot 2015-09-04 at 8.46.07 AM

After everything is working properly with Parse, open Xcode and start setting up.

Open Xcode and select Single View Application.

Screen Shot 2015-09-06 at 10.20.25 AM

In the next screen type in the following

Screen Shot 2015-09-06 at 12.32.43 PM

Product Name: Paws

Organization Name: Your Organization

Language: Swift

Devices: iPhone

When you’re done, hit next, select where you want to save your folder and click create.

Next step is to locate Main interface and delete “Main”, leave the box empty.

Now, we need to add the Parse library to Xcode with Cocoapods.

CocoaPods is the dependency manager for Swift and Objective-C Cocoa projects. It has over ten thousand libraries and can help you scale your projects elegantly. –

Open your terminal, hit cmd + space bard to open spotlight search, enter terminal and enter.

In Terminal, type “sudo gem install cocoapods” without the quotes

It will prompt you for you password, enter your password, after that, Don’t worry, it will take minutes for it to install cocoapods. It should look like the image

Screen Shot 2015-09-06 at 12.34.17 PM

shown below, yours might have fewer lines, I already installed mine so, 1 gem installed for me.

After the installation, first of, close your Xcode and back to your terminal, go to your projects root folder. Navigate your way to it by using these commands.

ls – list files and folders

cd <folder name> – to go to a folder

cd .. – go back one level

When you reach your projects root folder, type

nano Podfile

Screen Shot 2015-09-06 at 10.59.33 AM

Inside the Podfile, enter the following.

pod ‘Parse’, ‘~> 1.7.1’

pod ‘ParseUI’, ‘~> 1.1.3’

Screen Shot 2015-09-06 at 11.02.57 AM

When everything looks the same like the image above, ctrl + y to save, ctrl + x to exit, and it will ask you for a filename, just hit enter and you’ll be out.

To check if the file is created, use ls command or go to your GUI and navigate to your projects folder.

after checking and everything is fine, in the Terminal, type in,

pod install

Cocoapods will now check the Podfile we created and will install the dependencies we set. It will take a couple of minutes or so.

Screen Shot 2015-09-06 at 11.10.59 AM

Results should look similar to this. If everything runs well, you should see a new file called, Paws.xcworkspace inside you project’s root directory. From now on, we will start working with the new file.

We will now create a connection between Parse and our project. Parse is written in objective-C and our project is in Swift, We need to set it up for it to work together.

When opening the new workspace for the first time, you will see this dialog box asking to convert to lastest swift syntax, hit cancel.

Screen Shot 2015-09-06 at 11.25.04 AM

In your Xcodes navigation area, right click paws project and select New File…      in iOS->Source, select Objective-C file and hit next. Name your file any name you want and click next. Dialog box will pop up asking if you would like to configure an Objective-C bridging header, click Create Bridging Header.

Screen Shot 2015-09-06 at 11.28.04 AM

You’ll see two new files, Paws.m and Paws-Bridging-Header.h, whatever you named your new class. Delete Paws.m, and open Paws-Bridging-Header.h. Import the following, Parse.h, ParseUI.h, and Bolts.h.

Screen Shot 2015-09-06 at 11.36.27 AM

#import <Parse/Parse.h>

#import <ParseUI/ParseUI.h>

#import <Bolts/Bolts.h>

Let’s verify if our project with Parse is working, go to you parse account UI and select your Paws app, click Settings above and to your left you can see Keys, under General. Copy Application ID and Client Key.


go to our projects AppDelegate.swift, locate this method and enter the following code and replace the keys with your infos,

Press cmd + r to run the project, it should output a black screen because we removed “main” earlier. That’s fine though, it means everything is going to plan.

Create a table by right-clicking on the Paws directory and choose New File.., in iOS section, select Source category and click Cocoa Touch Class, hit next. Enter the following settings.

Class: CatsTVC

Subclass Of: PFQueryTableViewController

Language: Swift

uncheck Also create Xib file

Save the file. The class PFQueryTableViewController will inherit all of UITableViewController’s functionalities.

Open the new class we created and enter the following code above viewDidLoad() function.

And now, we implement the method queryForTable method of PFQueryTableViewController, method was inherited when we subclassed PFQueryTableViewController and we need to override it.

Add this code inside CatsTVC class.

Go back to AppDelegate.swift, inside didFinishLaunchingWithOptions method.

Run the app(cmd+r) and your output should look like this.

Screen Shot 2015-09-06 at 12.17.15 PM

Stay tuned for part 2 of the tutorial.

Leave A Comment

Your email address will not be published.