Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Love what you do & do what you love.

SashaTsebrii SashaTsebrii

👨‍💻
Love what you do & do what you love.
  • Odessa, UA
View GitHub Profile
View gist:1a411061ea9703f438ca35f2fc836e3f
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
// 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 Jun 12, 2018
Create label and set layout programmatically.
View gist:cff8f3ddc9ff3bc5b92d9f9396502903
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