/// | World |
/// |------------------------------------------|
/// | Module A | Module B | Module C | Module D|
- World is a module
- World is aware of all modules.
- Modules aren't aware of World.
struct MyModelDTO { | |
let property1: Type1 | |
let property2: Type2 | |
} | |
extension MyModelDTO { | |
init(model: MyModel_CoreData) { | |
self.init(property1: model.property1, property2: model.property2) | |
} | |
} |
public typealias CompletionHandler = Function<Void, Void> | |
public typealias SideEffect<Input> = Function<Input, Void> | |
public struct Function<Input, Output>: Identifiable { | |
public let id: String | |
internal let f: (Input) -> Output | |
public init( | |
id: String, |
import Foundation | |
@propertyWrapper struct Notifier<Value> { | |
private let identifier: String | |
var wrappedValue: Value? { | |
didSet { | |
NotificationCenter.default.post(name: Notification.Name(identifier), object: wrappedValue) | |
} | |
} |
import Combine | |
import ReactiveSwift | |
import SwiftUI | |
class AnySubscription: Subscription { | |
private let cancelable: Cancellable | |
init(cancelable: Cancellable) { | |
self.cancelable = cancelable |
Task { @MainActor in | |
} |
// let base = [1,2,4,6,5,8,6] | |
// let filtered = base.takeUntil{ $0.isMultiple(of: 2) } // [2,4,6] | |
// | |
// let base = [2,4,6,5,8,6] | |
// let filtered = base.takeUntil{ $0.isMultiple(of: 2) } // [2,4,6] | |
// | |
// It stops collecting when the predicate fails (5,8,6 are not evaluated) | |
// | |
// Idea by https://twitter.com/K0nserv | |
// |
/// | World |
/// |------------------------------------------|
/// | Module A | Module B | Module C | Module D|
/// This heavily based on the work done at RxGRDB | |
import GRDB | |
import ReactiveSwift | |
extension DatabasePool: ReactiveExtensionsProvider {} | |
extension DatabaseQueue: ReactiveExtensionsProvider {} | |
extension ValueObservation: ReactiveExtensionsProvider {} | |
extension DatabaseRegionObservation: ReactiveExtensionsProvider {} |
public typealias CompletionHandler = Function<Void, Void> | |
public typealias SideEffect<Input> = Function<Input, Void> | |
public struct Function<Input, Output>: Identifiable { | |
public let id: String | |
internal let f: (Input) -> Output | |
public init( | |
id: String, |
import ReactiveSwift | |
import XCTest | |
private let counterFailure: (Int, Int) -> String = { count, maxCount in | |
return "Counter is currently at \(count) which higher than the max \(maxCount)" | |
} | |
private let timeoutFailure = "Expectation timeout" | |
private let infoTemplate: (String, String, Int) -> String = { fileName, functionName, lineNumber in |