Last active
March 30, 2016 06:27
-
-
Save groue/aa47a05aa3063fcf67acb82343928930 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class PersonEditionViewController: UITableViewController { | |
var person: Person! | |
@IBOutlet private weak var nameCell: UITableViewCell! | |
@IBOutlet private weak var nameTextField: UITextField! | |
@IBOutlet private weak var scoreCell: UITableViewCell! | |
@IBOutlet private weak var scoreTextField: UITextField! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
configureView() | |
} | |
private func configureView() { | |
// Edit the name | |
nameTextField.text = person.name | |
// When the person has not been inserted in the database yet, | |
// use 0 as the sentinel for an empty score text field: | |
if person.id == nil && person.score == 0 { | |
scoreTextField.text = "" | |
} else { | |
scoreTextField.text = "\(person.score)" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment