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 | |
func recognize( input : String ) ->(Double,String,String){ | |
let pattern = "[^0-9.]+" | |
let regex = try! NSRegularExpression.init(pattern: pattern, options: []) |
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 | |
enum Unit : String { | |
case cm = "cm" | |
case m = "m" | |
case inch = "inch" | |
case yard = "yard" | |
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 | |
enum Unit : String { | |
case cm = "cm" | |
case m = "m" | |
case inch = "inch" |
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 | |
enum Unit : String { | |
case cm = "cm" | |
case m = "m" | |
case inch = "inch" |
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 Action { | |
case typing(String) | |
case tapSearchButton | |
case showLastCell | |
case fetchAutoCompletion([String]) | |
case fetchSearchResult(SearchResult) | |
} |
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 SideEffect { | |
case requestAutoCompletion(for: String) | |
case requestSearch(for: String) | |
case loadNextPage(at: Int) | |
} |
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 Instants { | |
case networkError(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
struct State { | |
var onProgress: Bool | |
var hasNextPage: Bool | |
var query: String | |
var autoCompletions: [String] | |
var searchResults: [SearchResult] | |
fileprivate var currentPage: Int | |
fileprivate var lastPage: Int | |
} |
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
protocol ViewModel { | |
associatedtype Input | |
associatedtype Output | |
func transform(_ input: Input) -> Output | |
} |
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 Output { | |
let onProcess: Driver<Bool> | |
let searchResults: Driver<[SearchResult]> | |
// .... | |
} |
OlderNewer