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
class ViewController: UIViewController { | |
let label = UILabel(frame: .zero) | |
let wrapper = Wrapper() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let closure = wrapper.observe1(label).keyPath(\.text) | |
closure { newValue in | |
print("observe1: \(String(describing: newValue))") |
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 PlaygroundSupport | |
import UIKit | |
// MARK: - ViewType | |
protocol ViewType: AnyObject { | |
func swapView(in viewController: UIViewController) | |
} | |
extension ViewType where Self: UIView { |
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
package jp.marty_suzuki.unio | |
import android.arch.lifecycle.LifecycleOwner | |
import android.arch.lifecycle.LiveData | |
import android.arch.lifecycle.MutableLiveData | |
import android.arch.lifecycle.Observer | |
import kotlin.reflect.KProperty1 | |
interface InputInterface | |
interface OutputInterface |
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
struct Generic<T> { | |
fileprivate let base: T | |
} | |
extension Generic where T == UICollectionView { | |
fileprivate init(_ base: UICollectionView) { | |
self.base = base | |
} |
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 Foundation | |
import UIKit | |
@_functionBuilder struct ConstraintBuilder { | |
static func buildBlock<T, U>(_ from: NSLayoutAnchor<T>, | |
_ relation: Relation<U>, | |
_ to: NSLayoutAnchor<T>) -> NSLayoutConstraint { | |
return U.constraint(from: from, to: to, constant: relation.constant) | |
} | |
} |
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 | |
import FirebaseAuth | |
public struct CombineAuth { | |
fileprivate let auth: Auth | |
} | |
extension CombineAuth { | |
public enum Error: Swift.Error { |
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
struct Weak<T: AnyObject> { | |
private let o: () -> T? | |
init(_ o: T) { | |
self.o = { [weak o] in o } | |
} | |
} | |
extension Weak { | |
func `do`<U>(execute: (T) -> U?) -> U? { |
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 Foundation | |
@dynamicMemberLookup | |
final class DynamicUserDefaults { | |
static var standard: DynamicUserDefaults { | |
return DynamicUserDefaults(.standard) | |
} | |
private let keys = Keys() |
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 UIKit | |
// - MRAK: Constraint | |
struct Constraint { | |
private let _constraint: (UIView, UIView) -> NSLayoutConstraint | |
init(_ constraint: @escaping (UIView, UIView) -> NSLayoutConstraint) { | |
self._constraint = constraint |
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 RxCocoa | |
import RxSwift | |
public protocol RxDUCValueType { | |
associatedtype E | |
var rawValue: E { get } | |
init(_ value: E, equals: @escaping (E, E) -> Bool) |