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
test123 |
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
extension String { | |
var onlyNumbers: String { | |
return components(separatedBy: .decimalDigits.inverted).joined() | |
} | |
} |
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 Foundation | |
extension Optional where Wrapped == Bool { | |
static prefix func !(value: Bool?) -> Bool? { | |
return value.flatMap { !$0 } | |
} | |
} | |
var isOn: Bool? = nil | |
isOn = 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
// 1. | |
enum Animal { | |
case cat | |
case dog | |
case foo | |
case bar | |
} | |
let count = 10 | |
let animal = Animal.cat |
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
iOS Development Course | |
В комментариях к стриму предложили отличное домашнее задание! | |
1) При авторизации / регистрации добавить сохранение в Keychain, могу порекомендовать библиотеку https://github.com/matthewpalmer/Locksmith | |
2) На экран LoginViewController добавить возможность авторизации с помощью Face ID, Touch ID. | |
Напоминаю, что нужно создать Pull Request в ветку dev. https://github.com/Hadevs/DKVK |
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 AVFoundation | |
func speak(text: String) { | |
let speechSynthesizer = AVSpeechSynthesizer() | |
let utterance = AVSpeechUtterance(string: text) | |
utterance.pitchMultiplier = 1 | |
utterance.rate = AVSpeechUtteranceDefaultSpeechRate | |
utterance.volume = 1 | |
utterance.voice = AVSpeechSynthesisVoice.speechVoices().randomElement() // Тут ты можешь выбрать проиграеваемый голос | |
speechSynthesizer.speak(utterance) |
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 ProVersionConstructor: NSObject, StaticConstructorContainer { | |
var models: [ProVersionConstructor.ModelType] = [ | |
.logo, .advantagesHeader, .instabilityText, .proVersionHeader, .exampleText, .empty, .upgradeButton | |
] | |
typealias ModelType = ProVersionCellModel | |
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 ProVersionViewController: UIViewController { | |
@IBOutlet weak var tableView: UITableView! | |
private let constructor = ProVersionConstructor() | |
private lazy var dataSource = constructor.delegateDataSource() | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
protocol StaticConstructorContainer { | |
associatedtype ModelType | |
var models: [ModelType] { get } | |
func cellType(for model: ModelType) -> StaticTableViewCellClass.Type | |
func configure(cell: UITableViewCell, by model: ModelType) | |
func itemSelected(item: ModelType) | |
} | |
extension StaticConstructorContainer { |
OlderNewer