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
Apache License | |
Version 2.0, January 2004 | |
http://www.apache.org/licenses/ | |
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |
1. Definitions. | |
"License" shall mean the terms and conditions for use, reproduction, | |
and distribution as defined by Sections 1 through 9 of this document. |
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 AppState: Equatable { | |
case featureOne(FeatureState) | |
case featureTwo(FeatureState) | |
case featureThree(FeatureState) | |
} | |
enum AppAction: Equatable { | |
case featureOne(FeatureAction) | |
case featureTwo(FeatureAction) | |
case featureThree(FeatureAction) |
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 Data { | |
// Returns a base64 encoded string, replacing reserved characters | |
// as per https://tools.ietf.org/html/rfc7636#section-4.2 | |
func pkce_base64EncodedString() -> String { | |
base64EncodedString() | |
.replacingOccurrences(of: "+", with: "-") | |
.replacingOccurrences(of: "/", with: "_") | |
.replacingOccurrences(of: "=", with: "") | |
.trimmingCharacters(in: .whitespaces) | |
} |
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
private func hexString(_ iterator: Array<UInt8>.Iterator) -> String { | |
return iterator.map { String(format: "%02x", $0) }.joined() | |
} | |
let exampleVerifier = "kM83K571n5KFW9u29Xu2qSqgoUwep4I2jZw8FGZg4Yr" | |
let verifierData = exampleVerifier.data(using: .utf8)! | |
// CommonCrypto implementation | |
var buffer = [UInt8](repeating: 0, count: Int(CC_SHA256_DIGEST_LENGTH)) | |
_ = verifierData.withUnsafeBytes { CC_SHA256($0.baseAddress, CC_LONG(verifierData.count), &buffer) } |
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 RawRepresentable where Self.RawValue == String { | |
/// Parses out the first matching raw value from a list of possible values, or returns nil. | |
/// | |
/// Example: | |
/// | |
/// enum SomeValues: String, CaseIterable { | |
/// case one | |
/// case two | |
/// } | |
/// |
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
struct TaggedOutput<Output> { | |
let token: AnyHashable | |
let output: Output | |
} | |
struct Effect<Output>: Publisher { | |
typealias Failure = Never | |
let base: AnyPublisher<TaggedOutput<Output>, Failure> | |
let token: AnyHashable |
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
2020-08-04 19:56:05.471109+0100 AudioSimulatorBug[5723:385998] libMobileGestalt MobileGestaltCache.c:38: No persisted cache on this platform. | |
2020-08-04 19:56:05.494965+0100 AudioSimulatorBug[5723:385162] [SceneConfiguration] Encoded configuration for UIWindowSceneSessionRoleApplication contained a UISceneDelegate class named "(null)", but no class with that name could be found. | |
2020-08-04 19:56:10.523921+0100 AudioSimulatorBug[5723:385162] HALCADClient::ConnectToServer: failed to find the AHS sub-server port, Error: 0x10004003 | |
2020-08-04 19:56:15.525034+0100 AudioSimulatorBug[5723:385162] HALCADClient::ConnectToServer: failed to find the AHS sub-server port, Error: 0x10004003 | |
2020-08-04 19:56:15.525272+0100 AudioSimulatorBug[5723:385162] HALDefaultDevice::Initialize: couldn't add the default input device listener, Error: 268451843 (\^P) | |
2020-08-04 19:56:20.525255+0100 AudioSimulatorBug[5723:385162] HALCADClient::ConnectToServer: failed to find the AHS sub-server port, Error: 0x10004003 | |
2020-08-04 19:56:2 |
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
2020-07-23 17:54:20.302611+0100 Poker Clock[15031:1458990] libMobileGestalt MobileGestaltCache.c:38: No persisted cache on this platform. | |
2020-07-23 17:54:25.428029+0100 Poker Clock[15031:1454775] HALCADClient::ConnectToServer: failed to find the AHS sub-server port, Error: 0x10004003 | |
2020-07-23 17:54:30.429086+0100 Poker Clock[15031:1454775] HALCADClient::ConnectToServer: failed to find the AHS sub-server port, Error: 0x10004003 | |
2020-07-23 17:54:30.429312+0100 Poker Clock[15031:1454775] HALDefaultDevice::Initialize: couldn't add the default input device listener, Error: 268451843 (\^P) | |
2020-07-23 17:54:35.430178+0100 Poker Clock[15031:1454775] HALCADClient::ConnectToServer: failed to find the AHS sub-server port, Error: 0x10004003 | |
2020-07-23 17:54:35.430464+0100 Poker Clock[15031:1454775] HALDefaultDevice::Initialize: couldn't add the default output device listener, Error: 268451843 (\^P) | |
2020-07-23 17:54:40.431523+0100 Poker Clock[15031:1454775] HALCADClient::ConnectToServer: failed to find the AHS su |
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
// full definition omitted: | |
public struct ValidatorOf<Value, Error> { | |
public let validate: (Value) -> Validated<Value, Error> | |
} | |
extension ValidatorOf { | |
static func its<T>(_ transform: @escaping (Value) -> T, _ validator: ValidatorOf<T, Error>) -> Self { | |
validator.pullback(transform) | |
} | |
} |
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 Validated | |
extension Validated { | |
func mapErrors<LocalError>(_ transform: (Error) -> LocalError) -> Validated<Value, LocalError> { | |
switch self { | |
case let .valid(value): | |
return .valid(value) | |
case let .invalid(errors): | |
return .invalid(errors.map(transform)) |