View gist:1a411061ea9703f438ca35f2fc836e3f
This file contains 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 ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { | |
@IBOutlet weak var theTextfield: UITextField! | |
let myPickerData = [String](arrayLiteral: "Peter", "Jane", "Paul", "Mary", "Kevin", "Lucy") | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. |
View gist:f5a3b0a9f360befacf4a6c617e5569fc
This file contains 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
// Default alert | |
let alert = UIAlertController(title: "Did you bring your towel?", message: "It's recommended you bring your towel before continuing.", preferredStyle: .alert) | |
alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: { action in | |
print("Yay! You brought your towel!") | |
})) | |
alert.addAction(UIAlertAction(title: "No", style: .cancel, handler: nil)) | |
self.present(alert, animated: true) | |
View gist:cff8f3ddc9ff3bc5b92d9f9396502903
This file contains 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
class ViewController: UIViewController { | |
// MARK: - Properties | |
let titleLabel: UILabel = { | |
let textLabel = UILabel() | |
textLabel.text = "Monday" | |
textLabel.font = UIFont.boldSystemFont(ofSize: 34) | |
textLabel.textAlignment = .center | |
return textLabel |