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
| /// A line which word has suitable length | |
| struct WordLengthLine: LineFromCorpusFromLine, Hashable { | |
| typealias FromLine = ParsedLine | |
| let line: FromLine | |
| } |
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
| /// A parsed line from some scanned line in the corpus. | |
| struct ParsedLine: Codable, Hashable { | |
| let wordForm: WordForm | |
| let partOfSpeechTag: PartOfSpeech | |
| let lemgrams: Lemgrams | |
| let isCompoundWord: Bool | |
| let numberOfOccurencesInCorpus: Int | |
| let relativeFrequencyPerOneMillion: Int |
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
| I've been developing iOS apps for 7 years now, Swift development since 2014 and SwiftUI since last summer. The biggest challenge for any iOS developer is navigation. But at least with UIKit we had control over the navigation stack, using UINavigationController. We could implement the "Coordinator pattern" and have somewhat control. This allows for implementation of animatable replacable modal flows. Which almost every app on earth needs/uses - at least those with logins (which most have?). | |
| Imagine this super common scenario: | |
| Start: goto Onboarding-flow if not signed-in; else goto Main-flow. | |
| Onboarding-flow: goto TermsOfService-flow if not acceptedToS; else (goto Tutorial-flow if not seenTutorial; else goto SignInOrSignUp) | |
| TermsOfService-flow: // display view with link to terms & conditions and link to privacy policy. Both will open modal webview content, need to check both Toggle views, should persist this data. Goto Tutorial-flow when done | |
| Tutorial-flow: // display multiple views steppable between | |
| SignInOr |
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 extension Publisher where Failure == Never { | |
| /// Publishes the first `n` elements of a stream, then finishes. | |
| func first(_ numberOfElements: Int) -> AnyPublisher<Output, Failure> { | |
| collect(numberOfElements) // "Buffer" | |
| .first() // "release and complete (finish)" | |
| // Publisher<[Output]> -> Publisher<Output> | |
| .map { $0.publisher }.switchToLatest() | |
| .eraseToAnyPublisher() | |
| } |
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 | |
| @testable import RadixSDK | |
| import XCTest | |
| import StubKit | |
| extension Address: Stubbable { | |
| public static func stub() -> Address { | |
| "JF5FTU5wdsKNp4qcuFJ1aD9enPQMocJLCqvHE2ZPDjUNag8MKun" | |
| } | |
| } |
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
| // MARK: - Compare + Mirror | |
| private func compareSome<T>(lhs: T, rhs: T, beSatisfiedWithSameAssociatedTypeIfTheirValuesDiffer: Bool) -> Bool { | |
| compareAny(lhs: lhs, rhs: rhs, beSatisfiedWithSameAssociatedTypeIfTheirValuesDiffer: beSatisfiedWithSameAssociatedTypeIfTheirValuesDiffer) | |
| } | |
| private func compareAny(lhs: Any, rhs: Any, beSatisfiedWithSameAssociatedTypeIfTheirValuesDiffer: Bool = true) -> Bool { | |
| let lMirror = Mirror(reflecting: lhs) | |
| let rMirror = Mirror(reflecting: 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
| import Foundation | |
| import XCTest | |
| @testable import RadixSDK | |
| class TransactionTestOldFormat: XCTestCase { | |
| func testTransactionWithSingleCreateTokenActionWithInitialSupply() { | |
| // GIVEN identity alice and a RadixApplicationClient | |
| let app = RadixApplicationClient.localhostAliceSingleNodeApp |
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 | |
| import XCTest | |
| @testable import RadixSDK | |
| class TransactionTestNewFormat: XCTestCase { | |
| func test_transaction_with_single_create_token_action_with_initial_supply() { | |
| given_identity_alice_and_a_radix_application_client { (aliceApp) in | |
| when_alice_observes_her_transactions_after_creating_token(withSupply: .mutable(initial: 123), given: aliceApp) { transaction in |
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 enum NodeFinding { | |
| case anySuitableNode(discovery: NodesDiscovery) | |
| case connectToSpecific(urlToNodes: [URL], ifAllSpecifiedNodesAreUnsuitable: StrategyWhenSpecifiedNodesAreUnsuitable) | |
| } | |
| public extension NodeFinding { | |
| struct StrategyWhenSpecifiedNodesAreUnsuitable { | |
| let strategyWhenSpecifiedNodesAreOffline: StrategyWhenSpecifiedNodesAreOffline | |
| let strategyWhenSpecifiedNodesDontServeShard: StrategyWhenSpecifiedNodesDontServeShard |