Skip to content

Instantly share code, notes, and snippets.

View dehrom's full-sized avatar
🤯
creating abstractions

Valery Kokanov dehrom

🤯
creating abstractions
View GitHub Profile
@dehrom
dehrom / DataSource.swift
Last active August 12, 2022 17:17
Repository pattern impl
import Combine
import Foundation
// MARK: - Typealiases
public typealias Seal<A, B: Error> = AnyPublisher<A, B>
// MARK: - Error
public enum DataSourceError: Error {
import Foundation
private let errorDebugDescriptionCreateBlock: (String, ContentRepresentable & IntCodeRepresentable & LocalizedErrorRepresentable) -> String = { name, error in
return """
=== Self is \(name) ===
Code: \(error.code) \r
errorDescription: \(String(describing: error.asLocalizedError?.errorDescription)) \r
failureReason: \(String(describing: error.asLocalizedError?.failureReason)) \r
recoverySuggestion: \(String(describing: error.asLocalizedError?.recoverySuggestion)) \r
// Copyright © 2019 Ooma Inc. All rights reserved.
import Foundation
import RIBs
import RxSwift
// MARK: - Plugin
public protocol Plugin: AnyObject {
associatedtype Component = Dependency