Skip to content

Instantly share code, notes, and snippets.

View SashaTsebrii's full-sized avatar
👨‍💻
Love what you do & do what you love.

OleksandrTsebrii SashaTsebrii

👨‍💻
Love what you do & do what you love.
View GitHub Profile
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.
// 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)
@SashaTsebrii
SashaTsebrii / gist:cff8f3ddc9ff3bc5b92d9f9396502903
Last active June 12, 2018 15:00
Create label and set layout programmatically.
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