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
| dispatch_semaphore_t semaphore = dispatch_semaphore_create(1); | |
| dispatch_queue_t renderQueue = dispatch_queue_create("com.throttling.queue", NULL); | |
| - (void) onlyExecuteOnceAtATime { | |
| if (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW) == 0) { | |
| dispatch_async(renderQueue, ^{ | |
| // execution code goes here | |
| dispatch_semaphore_signal(semaphore); | |
| }); | |
| } |
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
| // | |
| // YTMXResolver.h | |
| // | |
| // Copyright 2011 Yasir M Turk. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> | |
| #include <dns_sd.h> |
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 | |
| extension UIStackView { | |
| @discardableResult | |
| func removeAllArrangedSubviews() -> [UIView] { | |
| return arrangedSubviews.reduce([UIView]()) { $0 + [removeArrangedSubViewProperly($1)] } | |
| } | |
| func removeArrangedSubViewProperly(_ view: UIView) -> UIView { | |
| removeArrangedSubview(view) |
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 | |
| final class MockableTests { | |
| struct MockNotFound: Error { | |
| let message: String | |
| } | |
| } | |
| extension Bundle { | |
| static let tests = Bundle(for: MockableTests.self) |
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 | |
| final class SnapshotContainer: UIView { | |
| let view: UIView | |
| init(_ view: UIView, width: CGFloat, backgroundColor: UIColor = .white) { | |
| self.view = view | |
| super.init(frame: .zero) |
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
| @propertyWrapper | |
| public struct MaxSizeCollection<Value: Collection> { | |
| private let _maxSize: UInt? | |
| public var _value: Value | |
| public init(wrappedValue value: Value) { | |
| _value = value | |
| _maxSize = nil | |
| } |
OlderNewer