mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-04-23 00:58:41 +02:00
Add examples project
This commit is contained in:
41
Examples/GitHub Search/GitHubSearchWithSwiftUI/Extension/Combine.swift
Executable file
41
Examples/GitHub Search/GitHubSearchWithSwiftUI/Extension/Combine.swift
Executable file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// Combine.swift
|
||||
// GitHubSearchWithSwiftUI
|
||||
//
|
||||
// Created by marty-suzuki on 2019/06/05.
|
||||
// Copyright © 2019 jp.marty-suzuki. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct CombineExtension<Base> {
|
||||
let base: Base
|
||||
|
||||
init(_ base: Base) {
|
||||
self.base = base
|
||||
}
|
||||
}
|
||||
|
||||
protocol CombineCompatible {
|
||||
associatedtype CombineExtensionBase
|
||||
|
||||
static var combine: CombineExtension<CombineExtensionBase>.Type { get set }
|
||||
var combine: CombineExtension<CombineExtensionBase> { get set }
|
||||
}
|
||||
|
||||
extension CombineCompatible {
|
||||
|
||||
static var combine: CombineExtension<Self>.Type {
|
||||
get {
|
||||
return CombineExtension<Self>.self
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
var combine: CombineExtension<Self> {
|
||||
get {
|
||||
return CombineExtension<Self>(self)
|
||||
}
|
||||
set {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user