flow wrap
Creates a wrapper for a function returning Flow accepting no arguments
fun $NAME$(onEach: ($TYPE$) -> Unit, onCompletion: (Throwable?) -> Unit): Cancellable =
$NAME$().collect(onEach, onCompletion)
abstract class BeforeSuiteExtension : BeforeAllCallback, ExtensionContext.Store.CloseableResource { | |
companion object { | |
@JvmStatic | |
private val lock = ReentrantLock() | |
@JvmStatic | |
private var isStarted: Boolean = false | |
} |
func combineLatest<A, B, R>(_ aSequence: A, _ bSequence: B, transform: @escaping (A.Element, B.Element) -> R) -> AsyncStream<R> where A : AsyncSequence, B : AsyncSequence { | |
return AsyncStream { (continuation) async in | |
let aCurrentValue = Ref<A.Element?>(initialValue: nil) | |
let aTask = Ref<Task<Void, Error>?>(initialValue: nil) | |
let bCurrentValue = Ref<B.Element?>(initialValue: nil) | |
let bTask = Ref<Task<Void, Error>?>(initialValue: nil) | |
package com.cardlay.nebula.shared.query | |
class MapTree<K, V : Any> : MutableTree<K, V> { | |
private class MutableNode<K, V : Any> : Tree.Node<K, V> { | |
override val nodes = mutableMapOf<K, MutableNode<K, V>>() | |
override var value: V? = null | |
val size: Int | |
get() { | |
if (value != null) { |
import Swinject | |
private let prefix = "<asOneOf:" | |
private func nameOf<T>(_ serviceType: T) -> String { | |
return "\(prefix):\(String(reflecting: serviceType))>" | |
} | |
class AggregateBehavior<Common> : Behavior { | |
private var factories: [(Resolver) -> Common?] = [] |
import Combine | |
enum PublisherTimeoutError<Failure>: Error where Failure: Error { | |
case failure(Failure) | |
case timeout | |
} | |
extension Publisher { | |
func timeoutToNil<S>(after interval: S.SchedulerTimeType.Stride, scheduler: S) -> AnyPublisher<Output?, Failure> where S: Scheduler { | |
mapError({ error -> PublisherTimeoutError<Failure> in .failure(error) }) |
import Combine | |
import SwiftUI | |
/// Contains the gap between the smallest value for the y-coordinate of | |
/// the frame layer and the content layer. | |
private struct ContentOffsetPreferenceKey: PreferenceKey { | |
static var defaultValue: CGPoint = .zero | |
static func reduce(value: inout CGPoint, nextValue: () -> CGPoint) {} | |
} |
import Combine | |
extension Publishers { | |
struct MissingOutputError : Error {} | |
} | |
extension Future where Failure == Never { | |
var value: Output { | |
get async { | |
var cancellable: AnyCancellable? = nil |
import Combine | |
import Foundation | |
import shared | |
typealias OnEach<Output> = (Output) -> Void | |
typealias OnCompletion<Failure> = (Failure?) -> Void | |
typealias OnCollect<Output, Failure> = (@escaping OnEach<Output>, @escaping OnCompletion<Failure>) -> shared.Cancellable | |
/** |
import Combine | |
import Foundation | |
import shared | |
extension KotlinThrowable: Error { | |
} | |
struct PublisherFailures { | |
/** | |
The action to invoke when a failure is dropped as the result of a `Publisher` returned by |