Swiftpack.co - Package - 0xLeif/Combino

Combino

promise

promise<T>(work: @escaping (@escaping Future<T, Error>.Promise) -> Void) -> Future<T, Error>

promise(work: @escaping (@escaping Future<Void, Error>.Promise) -> Void) -> Future<Void, Error>

do

do<T>(withDelay delay: UInt32 = 0,
                               work: @escaping () throws -> T) -> Future<T, Error>

do(withDelay delay: UInt32 = 0,
                            work: @escaping () throws -> Void = {}) -> Future<Void, Error>

main

main<T>(withDelay delay: UInt32 = 0,
                               work: @escaping () throws -> T) -> Future<T, Error>

main(withDelay delay: UInt32 = 0,
                            work: @escaping () throws -> Void = {}) -> Future<Void, Error>

fetch

fetch(url: URLRequest) -> Future<(Data?, URLResponse?), Error>

fetch(url: URL) -> Future<(Data?, URLResponse?), Error>

post

post(request: URLRequest) -> Future<(Data?, URLResponse?), Error>

post(url: URL, withData data: (() -> Data)? = nil) -> Future<(Data?, URLResponse?), Error>

Combino Examples

.sink(SinkEvent)

Combino
    .do(withDelay: 5)
    .sink(.success { someFunction() })
    .store(in: &bag)

.sink(() -> [SinkEvent])

Combino
    .do(withDelay: 5) {
        "Hello World!"
}
.sink {
    [
        .completion {
            sema.signal()
        },
        .success { value in
            XCTAssertEqual(value, "Hello World!")
        },
        .failure { _ in
            XCTAssert(false)
        }
    ]
}
.store(in: &bag)

Github

link
Stars: 1

Dependencies

Used By

Total: 0

Releases

Combino+ - 2020-09-11 00:36:37

promise

promise<T>(work: @escaping (@escaping Future<T, Error>.Promise) -> Void) -> Future<T, Error>

promise(work: @escaping (@escaping Future<Void, Error>.Promise) -> Void) -> Future<Void, Error>

do

do<T>(withDelay delay: UInt32 = 0,
                               work: @escaping () throws -> T) -> Future<T, Error>

do(withDelay delay: UInt32 = 0,
                            work: @escaping () throws -> Void = {}) -> Future<Void, Error>

main

main<T>(withDelay delay: UInt32 = 0,
                               work: @escaping () throws -> T) -> Future<T, Error>

main(withDelay delay: UInt32 = 0,
                            work: @escaping () throws -> Void = {}) -> Future<Void, Error>

fetch

fetch(url: URLRequest) -> Future<(Data?, URLResponse?), Error>

fetch(url: URL) -> Future<(Data?, URLResponse?), Error>

post

post(request: URLRequest) -> Future<(Data?, URLResponse?), Error>

post(url: URL, withData data: (() -> Data)? = nil) -> Future<(Data?, URLResponse?), Error>

Combino Examples

.sink(SinkEvent)

Combino
    .do(withDelay: 5)
    .sink(.success { someFunction() })
    .store(in: &bag)

.sink(() -> [SinkEvents])

Combino
    .do(withDelay: 5) {
        "Hello World!"
}
.sink {
    [
        .completion {
            sema.signal()
        },
        .success { value in
            XCTAssertEqual(value, "Hello World!")
        },
        .failure { _ in
            XCTAssert(false)
        }
    ]
}
.store(in: &bag)

Combino - 2020-09-10 23:23:27

promise

promise<T>(work: @escaping (@escaping Future<T, Error>.Promise) -> Void) -> Future<T, Error>

promise(work: @escaping (@escaping Future<Void, Error>.Promise) -> Void) -> Future<Void, Error>

do

do<T>(withDelay delay: UInt32 = 0,
                               work: @escaping () throws -> T) -> Future<T, Error>

do(withDelay delay: UInt32 = 0,
                            work: @escaping () throws -> Void = {}) -> Future<Void, Error>

main

main<T>(withDelay delay: UInt32 = 0,
                               work: @escaping () throws -> T) -> Future<T, Error>

main(withDelay delay: UInt32 = 0,
                            work: @escaping () throws -> Void = {}) -> Future<Void, Error>

fetch

fetch(url: URLRequest) -> Future<(Data?, URLResponse?), Error>

fetch(url: URL) -> Future<(Data?, URLResponse?), Error>

post

post(request: URLRequest) -> Future<(Data?, URLResponse?), Error>

post(url: URL, withData data: (() -> Data)? = nil) -> Future<(Data?, URLResponse?), Error>

Combino Examples

.sink(SinkEvent)

Combino
    .do(withDelay: 5)
    .sink(.success { someFunction() })
    .store(in: &bag)

.sink(() -> [SinkEvents])

Combino
    .do(withDelay: 5) {
        "Hello World!"
}
.sink {
    [
        .completion {
            sema.signal()
        },
        .success { value in
            XCTAssertEqual(value, "Hello World!")
        },
        .failure { _ in
            XCTAssert(false)
        }
    ]
}
.store(in: &bag)