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
| /** | |
| Provide a convenience way to examine FPS, to get more precise and detail info you still need to use Instruments. | |
| */ | |
| @objc | |
| class DebugFPS: NSObject { | |
| private static let shared = DebugFPS() // static is lazy | |
| private var lastScreenUpdateAt: TimeInterval? // mach_absolute_time | |
| private var accumulatedFrames = 0 |
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 APIRequest { | |
| associatedtype RequestDataType | |
| associatedtype ResponseDataType | |
| func makeRequest(from data: RequestDataType) throws -> URLRequest | |
| func parseResponse(data: Data) throws -> ResponseDataType | |
| } | |
| class APIRequestLoader<T: APIRequest> { | |
| let apiRequest: T |
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 ApiTimeHelper { | |
| static private var dic = [String: NSDate]() | |
| static private var dicStopTimes = [String: Int]() | |
| static func start(tag: String) { | |
| dic.updateValue(NSDate(), forKey: tag) | |
| dicStopTimes.updateValue(0, forKey: tag) | |
| } | |
| static func stop(tag: String, note: String? = nil) { |