PFLoginViewController appearing

66 Views Asked by At

I'm trying to setup the Parse PFLoginViewController to appear. Here's my class for one of my viewControllers.

import UIKit

import Parse
import ParseUI

class FirstViewController: PFLogInViewController, UITableViewDataSource, UITableViewDelegate,  PFLogInViewControllerDelegate {

    @IBOutlet weak var tableView: UITableView!

    var textArray:NSMutableArray! = NSMutableArray()

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.


    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {


        return self.textArray.count
    }


    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as! UITableViewCell


        cell.textLabel?.text = self.textArray.objectAtIndex(indexPath.row) as? String

        return cell
    }
}

What I don't understand is, why is the PFLoginViewController appearing when I run the app? I'm not doing the setup code to make it appear, so I'm confused why it's appearing.

My guess is that somehow my viewController is being automatically replaced with the PFLogInViewController somehow because I included it in the top?

My project is a Swift app.

1

There are 1 best solutions below

7
Stuart On BEST ANSWER

Your FirstViewController is PFLogInViewController (a subclass). If FirstViewController is the rootViewController of your app's window, or if it's the first/root view controller of a container view controller that is itself the window's rootViewController, then you will see the PFLogInViewController when you run your app.

When you define a class in Swift, the first type after the colon is superclass of that class (or, if the first type after the colon is a protocol, your class is a root class that does not inherit from a superclass).