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
final class ViewController: UIViewController { | |
let keyboard = KeyboardObserver() | |
weak var firstRespounder: UIView? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
keyboard.handler = { | |
[weak self] state in |
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 KeyboardObserver { | |
enum KeyboardState { | |
case hide, show(CGRect) | |
var height: CGFloat { | |
switch self { | |
case .hide: |
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 | |
// Module | |
class FeedViewController: UIViewController { | |
let model = FeedModel() | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
protocol ServiceLocator { | |
func getService<T>(_: T.Type) -> T | |
func getService<T>() -> T | |
} | |
extension ServiceLocator { | |
func getService<T>() -> T { | |
return getService(T.self) | |
} |
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
// | |
// ViewController.swift | |
// avfoundation-avaudioplayer-power-visualizer | |
// | |
// Created by Maxim Vialyx on 9/12/19. | |
// Copyright © 2019 Maxim Vialyx. All rights reserved. | |
// | |
import UIKit | |
import AVFoundation |
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
// | |
// AudioPlayerComposition.swift | |
// avfoundation-avaudioplayer-power-visualizer | |
// | |
// Created by Maxim Vialyx on 9/12/19. | |
// Copyright © 2019 Maxim Vialyx. All rights reserved. | |
// | |
import UIKit | |
import AVFoundation |
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
// | |
// AudioPowerVisualizerView.swift | |
// avfoundation-avaudioplayer-power-visualizer | |
// | |
// Created by Maxim Vialyx on 9/12/19. | |
// Copyright © 2019 Maxim Vialyx. All rights reserved. | |
// | |
import UIKit | |
import AVFoundation |
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() | |
// Create MaskedLabelView | |
let edges = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20) | |
let maskedView = MaskedLabelView(frame: view.frame.inset(by: edges)) | |
view.addSubview(maskedView) | |
// Setup UILabel preferences |
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 MaskedLabelView: UIView { | |
weak var label: UILabel! | |
var startColor: UIColor = .blue | |
var endColor: UIColor = .black | |
var duration: CFTimeInterval = 2.0 | |
var repeatCount: Float = Float.infinity | |
var completion: ((Bool) -> Void)? | |
// CAGradientLayer provide api to work with gradient colors |
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 | |
extension Segue { | |
static var signup: Segue = Segue(identifier: "signup") | |
} | |
class OBEmailViewController: UIViewController { | |