Error trying to setup a UIPickerView's data source
<p>I get this error: /Users/natumyers/Desktop/proj/SignUp2ViewController.swift:11:7: Type 'SignUp2ViewController' does not conform to protocol 'UIPickerViewDataSource'. I am following this tutorial <a href="http://codewithchris.com/uipickerview-example/" rel="nofollow">http://codewithchris.com/uipickerview-example/</a> but I have a view controller that's separate from the default one.</p>

<pre><code>import UIKit

class SignUp2ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {

    @IBOutlet weak var signuplabel: UITextField!

    var labelText = String()

    @IBOutlet weak var focusPicker: UIPickerView!
    var focusPickerData: [String] = [String]()

    override func viewDidLoad() {

        super.viewDidLoad()

        // Connect data:
        self.focusPicker.delegate = self
        self.focusPicker.dataSource = self

        focusPickerData = ["type1","type2","type3","type4"]

        signuplabel.text = labelText
    }

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

<p>Solution</p>

<p>The functions were key for this to work. I added:</p>

<pre><code>// The number of columns of data
    func numberOfComponentsInPickerView(pickerView: UIPickerView) -&gt; Int {
        return 1
    }

// The number of rows of data
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -&gt; Int {
    return focusPickerData.count
} 
// The data to return for the row and component (column) that's being passed in
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -&gt; String? {
    return focusPickerData[row]
}
</code></pre>

<p>After the didReceiveMemoryWarning function.</p>