One Month iOS tutorial
Follow instruction from parse.com
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
self.setupParse()
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
if PFUser.currentUser() == nil{
// TODO: present the main UI
println("User does not exist")
}
else{
// TODO: Present UI for logging in or creating an account
println("We have an user")
}
return true
}
func setupParse(){
Parse.setApplicationId(_applicationID_, clientKey:_clientKey_)
}
Create a StartViewController file inherts from UIViewController with a xib file, and then add the following code
var startViewController = StartViewController(nibName:"StartViewController", bundle:nil)
if PFUser.currentUser() == nil{
// TODO: present the main UI
navigationController.viewControllers = [startViewController]
}
else{
// TODO: Present UI for logging in or creating an account
println("We have an user")
}
self.window!.rootViewController = navigationController
self.window!.makeKeyAndVisible()
Adding buttons to the login screen
Add sign in and sign up buttons functions and connect them to the UI e.g.
@IBAction func didTapSignIn(sender: AnyObject){
var viewController = AuthViewController(nibName:"AuthViewController", bundle:nil)
self.navigationController!.pushViewController(viewController, animated: true)
}
Add AuthViewContrller.swift