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
/// Wait for async operation to return value and call callback with the value | |
/// This class is intended to workaround/simplify async/await + actors isolation | |
/// https://twitter.com/krzyzanowskim/status/1523233140914876416 | |
private class AsyncWaiter<T> { | |
var didReceiveValue: Bool = false | |
let value: (T) -> Void | |
let operation: () async throws -> T | |
init(_ value: @escaping (T) -> Void, operation: @escaping () async throws -> T) { | |
self.value = value |
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 Foundation | |
class Debounce { | |
private let queue: DispatchQueue | |
private let delay: Double | |
private var workItem: DispatchWorkItem? | |
private var cancelBlock: (() -> Void)? | |
init(queue: DispatchQueue, delay: Double) { | |
self.queue = queue |
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 Foundation | |
class Throttle { | |
private let queue: DispatchQueue | |
private let delay: Double | |
private var delayedBlock: (() -> Void)? | |
private var cancelBlock: (() -> Void)? | |
private var timer: DispatchSourceTimer? | |
private var isReady = true | |
private var hasDelayedBlock: Bool { delayedBlock != nil } |
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
extension JWT { | |
var email: String? { | |
return claim(name: "email").string | |
} | |
} |
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
extension UIWindow { | |
/// Fix for http://stackoverflow.com/a/27153956/849645 | |
func set(rootViewController newRootViewController: UIViewController, | |
withTransition transition: CATransition? = nil) { | |
let previousViewController = rootViewController | |
if let transition = transition { | |
// Add the transition |
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
{ | |
"current_page": 1, | |
"data": [ | |
{ | |
"type": "draft", | |
"source": "subscribe", | |
"trainings_count": 10, | |
"created_at": "2019-04-23 17:10:42", | |
"trainings": [ | |
{ |
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
enum ServiceError: Error { | |
case timeout | |
case nilData | |
} | |
extension SwaggerClientAPI { | |
private enum HeadersKeys: String { | |
case authorization = "Authorization" | |
} | |
class func setBearer(_ token: String) { |
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
public struct InviteFeedModel: Codable { | |
public var level: Int? | |
public var performerId: String | |
public var performerName: String? | |
public var newParticipantId: String? | |
public var newParticipantName: String? | |
public init(level: Int?, performerId: String, performerName: String?, newParticipantId: String?, newParticipantName: String?) { | |
self.level = level |
NewerOlder