Created
November 3, 2016 06:19
-
-
Save Limon-O-O/1b8b80d19e4dfed8fe3e5e57a5eab6ac to your computer and use it in GitHub Desktop.
Struct Extension
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 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