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 Grade: Comparable, CustomStringConvertible { | |
| case a(InneGrade) | |
| case b(InneGrade) | |
| case c(InneGrade) | |
| case d(InneGrade) | |
| case e(InneGrade) | |
| case f | |
| } | |
| extension Grade { |
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 ActivityType { | |
| case football | |
| case chess | |
| } | |
| class Activity { | |
| let type: ActivityType | |
| let payload: Any | |
| } |
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 Month: Int, CaseIterable { | |
| case jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec | |
| } | |
| extension Month { | |
| var season: Season { | |
| return Season(month: 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
| extension DecodingError: Equatable { | |
| static func dataCorrupted(description: String) -> DecodingError { | |
| return DecodingError.dataCorrupted(DecodingError.Context(codingPath: [], debugDescription: description)) | |
| } | |
| public static func == (lhs: DecodingError, rhs: DecodingError) -> Bool { | |
| switch (lhs, rhs) { |
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
| typealias JSON = [String: Any] | |
| func recursivelyDeleteValue(forKey jsonKey: String, in jsonAny: Any) -> Any { | |
| if var jsonObject = jsonAny as? JSON { | |
| jsonObject.removeValue(forKey: jsonKey) | |
| let loopable = jsonObject | |
| for (key, value) in loopable { | |
| jsonObject[key] = recursivelyDeleteValue(forKey: jsonKey, in: value) | |
| } | |
| return jsonObject | |
| } else if let jsonArray = jsonAny as? [JSON] { |
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
| class RIPEMD160Tests: XCTestCase { | |
| func testTestVectors() { | |
| for vector in testVectors { | |
| let asciiMessage = vector.0 | |
| let expectedHash = vector.1 | |
| XCTAssertEqual( | |
| RIPEMD160.hash(message: asciiMessage, encoding: .ascii).toHexString(), | |
| expectedHash | |
| ) | |
| } |
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
| /// RIPEMD160 implementation in Swift 5. | |
| /// | |
| /// Based on the work of Sjors Provoost, found on [Github CryptoCoinSwift][1] | |
| /// | |
| /// Migrated to Swift 5 by [Alex Cyon a.k.a. Sajjon][2] | |
| /// | |
| /// [1]: https://github.com/CryptoCoinSwift/RIPEMD-Swift | |
| /// [2]: https://github.com/Sajjon | |
| /// |
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 Darwin | |
| @dynamicMemberLookup | |
| struct Environment { | |
| subscript(dynamicMember name: String) -> String? { | |
| get { | |
| guard let value = getenv(name) else { return nil } | |
| return String(validatingUTF8: 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
| private extension OnboardingCoordinator { | |
| func toTermsOfService() { | |
| let viewModel = TermsOfServiceViewModel(useCase: onboardingUseCase) | |
| push(scene: TermsOfService.self, viewModel: viewModel) { [unowned self] userDid in | |
| switch userDid { | |
| case .acceptTermsOfService: self.toAnalyticsPermission() | |
| } | |
| } | |
| } |
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
| typealias DismissScene = (_ animatedDismiss: Bool, _ presentationCompletion: (() -> Void)?) -> Void | |
| extension BaseCoordinator { | |
| /// This method is used to modally present a Scene. | |
| /// | |
| /// - Parameters: | |
| /// - scene: Type of `Scene` (UIViewController) to present. | |
| /// - viewModel: An instance of the ViewModel used by the `Scene`s View. | |
| /// - animated: Whether to animate the presentation of the scene or not. | |
| /// - navigationHandler: **Required** closure handling the navigation steps emitted by the scene's ViewModel. | |
| /// - step: The navigation steps emitted by the `viewmodel` |