Skip to content

Instantly share code, notes, and snippets.

@Limon-O-O
Created November 3, 2016 06:19
Show Gist options
  • Save Limon-O-O/1b8b80d19e4dfed8fe3e5e57a5eab6ac to your computer and use it in GitHub Desktop.
Save Limon-O-O/1b8b80d19e4dfed8fe3e5e57a5eab6ac to your computer and use it in GitHub Desktop.
Struct Extension
import AVFoundation
public typealias AOIBaseType = AOIBaseProtocol
public protocol AOIBaseProtocol {
associatedtype T
var aoi: T { get }
static var aoi: T.Type { get }
}
extension TimeProxy {
public static var zero: CMTime {
return kCMTimeZero
}
public var seconds: Double {
return CMTimeGetSeconds(base)
}
}
public struct TimeProxy {
fileprivate let base: CMTime
init(_ base: CMTime) {
self.base = base
}
}
extension CMTime: AOIBaseType {
public typealias T = TimeProxy
public var aoi: T {
return T(self)
}
public static var aoi: T.Type {
return T.self
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment