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 | |
// OAuth2Token structure | |
struct OAuth2Token: Codable { | |
let date = Date() // date when the token was initialized | |
var accessToken: String // access token | |
var refreshToken: String? // refresh token (optional) | |
var expiresIn: Int // seconds until token expires | |
var tokenType: String // for example "Bearer" |
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 | |
import AVKit | |
class VideoView: UIView { | |
// video layer that will stream the url | |
private let videoLayer = AVPlayerLayer() | |
// pan gesture used for scrubbing | |
private let panGesture = UIPanGestureRecognizer() |
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 ImageView: UIImageView { | |
// image data | |
var data: Data? { | |
didSet { | |
// render image | |
renderImage() | |
} |
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 | |
/// operator declaration | |
infix operator <- | |
/// Maps right instance to left if of same type | |
/// | |
/// - Parameters: | |
/// - left: optional instance to be mapped | |
/// - right: optional mapping value |