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 Parse.com using your Facebook, Github, or Google+ account, or by email.
Go to parse.com/apps and click Create a New App.
Name your app Paws and hit create.
In the Core tab from top, click the Add Class button.
dropdown box should remain Custom. Click Create Class and now you have an online storage, Data is stored as objects. Click this +col.
Now create these fields with their data types.
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.
After importing and everything went well, your table should look like this. Filled with 10 cat names.
After everything is working properly with Parse, open Xcode and start setting up.
Open Xcode and select Single View Application.
In the next screen type in the following
Product Name: Paws
Organization Name: Your Organization
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. – CocoaPods.org
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
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
Inside the Podfile, enter the following.
pod ‘Parse’, ‘~> 1.7.1’
pod ‘ParseUI’, ‘~> 1.1.3’
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,
Cocoapods will now check the Podfile we created and will install the dependencies we set. It will take a couple of minutes or so.
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.
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.
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.
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.
Subclass Of: PFQueryTableViewController
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.
Stay tuned for part 2 of the tutorial.
Tags: parse, swift, tutorials, xcode
You ever thought of writing all your codes in Swift?…
What is postfix? Postfix is a native mail transfer agent…
I updated my OS X to El Capitan 2 days…
Your email address will not be published.
Notify me of follow-up comments by email.
Notify me of new posts by email.