Skip to content

Instantly share code, notes, and snippets.

View freshking's full-sized avatar

Bastian Kohlbauer freshking

View GitHub Profile
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"
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()
import UIKit
class ImageView: UIImageView {
// image data
var data: Data? {
didSet {
// render image
renderImage()
}
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