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
// | |
// AnimateableImageView.swift | |
// | |
// | |
// Created by Kirill Pustovalov | |
// | |
import UIKit | |
@objc |
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
let decoder = JSONDecoder() | |
if let data = data { | |
do { | |
// process data | |
} catch let DecodingError.dataCorrupted(context) { | |
print(context) | |
} catch let DecodingError.keyNotFound(key, context) { | |
print("Key '\(key)' not found:", context.debugDescription) | |
print("codingPath:", context.codingPath) | |
} catch let DecodingError.valueNotFound(value, context) { |
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
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
NotificationCenter.default.addObserver(self, selector: #selector(keyboardDidShow), name: UIResponder.keyboardDidShowNotification, object: nil) | |
NotificationCenter.default.addObserver(self, selector: #selector(keyboardDidHide), name: UIResponder.keyboardDidHideNotification, object: nil) | |
} | |
@objc func keyboardDidShow(notification: Notification) { | |
guard let userInfo = notification.userInfo else { return } |
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 ViewController: UIViewController { | |
let timerLabel: UILabel = { | |
let timerLabel = UILabel() | |
timerLabel.font = timerLabel.font.withSize(50) | |
timerLabel.textAlignment = .center | |
return timerLabel | |
}() | |
override func viewDidLoad() { |