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
/// Distributed lock based on file locking | |
final class DistributedLock: NSLocking { | |
enum Error: Swift.Error { | |
case failToAquireLock | |
} | |
private let fileURL: URL | |
private var fileDescriptor: Int32 = -1 | |
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 | |
public enum SafeCodableEnum<Nested: RawRepresentable & Codable> where Nested.RawValue: Codable { | |
case defined(Nested) | |
case other(Nested.RawValue) | |
} | |
extension SafeCodableEnum: RawRepresentable { |
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 UIKit | |
import SwiftUI | |
protocol AnyNode: AnyCodableType { | |
var id: UUID { get } | |
} | |
protocol AnyNodeContent: AnyCodableType {} | |
extension AnyNodeContent { | |
static func register() { |
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 final class Stopwatch { | |
var start: DispatchTime = .now() | |
let maxTime: TimeInterval | |
let measurementTitle: String | |
private var isReportedAtLeastOnce = false | |
@discardableResult | |
static func create(title: String = #function, maxTime: TimeInterval = 0) -> Stopwatch { |
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
// | |
// KeyPathBasedConfiguration.swift | |
// | |
// Created by Maxim Kotliar on 13.02.2020. | |
// Copyright © 2020 Wikrgroup. All rights reserved. | |
// | |
import Foundation | |
@dynamicMemberLookup |
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 UIKit | |
import PlaygroundSupport | |
import CoreGraphics | |
extension Numeric { | |
/// Linear interpolation | |
/// - Parameters: | |
/// - a: a value to interpolate from | |
/// - b: a value to interpolate to | |
/// - delta: interpolation delta value (0 - 1) |
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
// | |
// UserDefaultsManagedWrapper.swift | |
// Yoga | |
// | |
// Created by Maxim Kotliar on 11.12.2019. | |
// Copyright © 2019 Wikrgroup. All rights reserved. | |
// | |
import Foundation | |
import Bindy |
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
// AVPlayerDelegate.swift | |
// | |
// Created by Maxim Kotliar on 7/30/18. | |
// | |
import AVFoundation | |
@objc protocol AVPlayerDelegate: class { | |
@objc optional func playerDidStartPlayback() | |
@objc optional func playerDidPausePlayback() |
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 KeyedDecodingContainer { | |
struct Safe<Base: Decodable>: Decodable { | |
public let value: Base? | |
public init(from decoder: Decoder) throws { | |
do { | |
let container = try decoder.singleValueContainer() | |
self.value = try container.decode(Base.self) | |
} catch { |