This file contains 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
# Enable/Disable Touch Indicator on iOS simulator | |
defaults write com.apple.iphonesimulator ShowSingleTouches 1 | |
This file contains 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 | |
import UIKit | |
extension NSAttributedString { | |
typealias Attributes = [NSAttributedString.Key: Any] | |
} |
This file contains 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 MyError { | |
case errorOne | |
case errorTwo | |
} | |
extension MyError: Error { | |
} | |
/* |
This file contains 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 Publisher { | |
var asAsyncThrowingStream: AsyncThrowingStream<Output, any Error> { | |
AsyncThrowingStream { continuation in | |
// Produce item using yield | |
let cancellable = self.sink { completion in | |
switch completion { | |
case .failure(let error): | |
continuation.finish(throwing: error) |
This file contains 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
/// NSHashTable | |
/// https://developer.apple.com/documentation/foundation/nshashtable | |
/// | |
/// NSMapTable | |
/// https://developer.apple.com/documentation/foundation/nsmaptable | |
/// | |
/// NSHashTable & NSMapTable | |
/// https://nshipster.com/nshashtable-and-nsmaptable/ | |
/// |
This file contains 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 PlaygroundPage { | |
var dataDirectoryURL: URL? { | |
let directory = playgroundSharedDataDirectory | |
.deletingLastPathComponent() | |
.appendingPathComponent("Shared Playground Data", isDirectory: true) | |
guard !FileManager.default.fileExists(atPath: directory.path(), isDirectory: nil) | |
else { return directory } | |
do { |
This file contains 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
struct KeyValue<Key, Value> { | |
let key: Key | |
let value: Value | |
} | |
extension KeyValue: Equatable where Key: Equatable, Value: Equatable {} | |
extension KeyValue: Hashable where Key: Hashable, Value: Hashable {} | |
extension KeyValue: Encodable where Key: Encodable, Value: Encodable {} |
This file contains 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 Combine | |
protocol ValueDispatching<Output, Failure>: AnyObject { | |
associatedtype Output | |
associatedtype Failure: Error | |
func send(_ value: Output) | |
func send(error: Failure) | |
func completed() | |
} |
This file contains 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 enum PasswordRule { | |
public enum CharacterClass { | |
case upper | |
case lower | |
case digits | |
case special | |
case asciiPrintable | |
case unicode | |
case custom(Set<Character>) |
NewerOlder