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
// | |
// AccumulatingDebounce.swift | |
// | |
// Created by Daniel Tartaglia on 10 Mar 2023. | |
// Copyright © 2023 Daniel Tartaglia. MIT License. | |
// | |
import Foundation | |
import RxSwift |
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
// | |
// Restart.swift | |
// | |
// Created by Daniel Tartaglia on 23 Jun 2022. | |
// Copyright © 2022 Daniel Tartaglia. MIT License. | |
// | |
import RxSwift | |
extension ObservableType { |
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
@resultBuilder | |
enum ArrayBuilder<OutputModel> { | |
static func buildEither(first component: [OutputModel]) -> [OutputModel] { | |
return component | |
} | |
static func buildEither(second component: [OutputModel]) -> [OutputModel] { | |
return component | |
} |
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
extension AnyPublisher where Failure: Error { | |
struct Subscriber { | |
fileprivate let send: (Output) -> Void | |
fileprivate let complete: (Subscribers.Completion<Failure>) -> Void | |
func send(_ value: Output) { self.send(value) } | |
func send(completion: Subscribers.Completion<Failure>) { self.complete(completion) } | |
} | |
init(_ closure: (Subscriber) -> AnyCancellable) { |
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 Combine | |
extension Publishers { | |
public struct WithLatestFrom<Upstream: Publisher, Other: Publisher>: | |
Publisher where Upstream.Failure == Other.Failure | |
{ | |
// MARK: - Types | |
public typealias Output = (Upstream.Output, Other.Output) | |
public typealias Failure = Upstream.Failure |
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
// | |
// TokenAcquisitionService.swift | |
// CombineSandbox | |
// | |
// Created by Daniel Tartaglia on 11/27/19. | |
// Copyright © 2019 Daniel Tartaglia. MIT License. | |
// | |
import Foundation | |
import Combine |
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
// | |
// Combine+WithLatestFrom.swift | |
// | |
// Created by Shai Mishali on 29/08/2019. | |
// Copyright © 2019 Shai Mishali. All rights reserved. | |
// | |
import Combine | |
// MARK: - Operator methods |
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 Combine | |
struct ZipMany<Element, Failure>: Publisher where Failure: Error { | |
typealias Output = [Element] | |
private let underlying: AnyPublisher<Output, Failure> | |
init<T: Publisher>(publishers: [T]) where T.Output == Element, T.Failure == Failure { | |
let zipped: AnyPublisher<[T.Output], T.Failure>? = publishers.reduce(nil) { result, publisher in | |
if let result = result { |
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
// | |
// ObservableResultTransforms.swift | |
// | |
// Created by Daniel Tartaglia on 5/10/2019. | |
// Copyright © 2019 Daniel Tartaglia. MIT License. | |
// | |
import RxSwift | |
/** |
NewerOlder