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 |
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) | |
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. |