@dynamicMemberLookup
struct DriverFor<Base> {
var 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 RxSwift | |
import RxCocoa | |
import RxRelay | |
extension Disposable { | |
public func wrapIntoAnyDisposable() -> AnyDisposable { | |
return AnyDisposable(self) | |
} | |
} |
The original proposal: https://github.com/DougGregor/swift-evolution/blob/property-delegates/proposals/NNNN-property-delegates.md
- A user can create custom property delegates that allow a
var
declaration to decide how to implement the storage. - The original proposal want to use a new identifier space, prefixed by
$
, to uniquely identify a property delegate from the computed and non-prefixed main property.
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
public struct Unique<Key, Value>: Hashable where Key: Hashable { | |
public enum KeyVariant { | |
case key(Key) | |
case keyPath(KeyPath<Value, Key>) | |
case closure((Value) -> Key) | |
internal func _key(for value: Value) -> Key { | |
switch self { | |
case .key(let key): |
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 Ref { | |
weak var obj: Obj? { | |
didSet { print("didSet", obj as Any) } | |
} | |
} | |
class Obj { | |
weak var ref: Ref? | |
func unlink(from ref: Ref) { |
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
public enum Foo : OptionSet { | |
case a | |
case b | |
case value(UInt8) | |
public var rawValue: UInt8 { | |
switch self { | |
case .a: |
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
protocol ValueContainer { | |
associatedtype Value | |
var value: Value { get } | |
init(_ value: Value) | |
} | |
extension ValueContainer where Self : Equatable, Value : Equatable { | |
static func == (lhs: Self, rhs: Self) -> Bool { | |
return lhs.value == rhs.value | |
} |
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 RxSwift | |
public final class DisposeCache<Key> | |
: ExpressibleByDictionaryLiteral where Key : Hashable { | |
/// | |
private var lock = NSRecursiveLock() | |
/// | |
private var storage: [Key: Disposable] |
Path | Protocol |
---|---|
/swift/stdlib/public/core/AnyHashable.swift:16 | _HasCustomAnyHashableRepresentation |
/swift/stdlib/public/core/BidirectionalCollection.swift:21 | _BidirectionalIndexable |
/swift/stdlib/public/core/BridgeObjectiveC.swift:19 | _ObjectiveCBridgeable |
/swift/stdlib/public/core/Collection.swift:20 | _IndexableBase |
/swift/stdlib/public/core/Collection.swift:176 | _Indexable |
/swift/stdlib/public/core/CompilerProtocols.swift:193 | _ExpressibleByBuiltinIntegerLiteral |
/swift/stdlib/public/core/CompilerProtocols.swift:240 | _ExpressibleByBuiltinFloatLiteral |
/swift/stdlib/public/core/CompilerProtocols.swift:283 | _ExpressibleByBuiltinBooleanLiteral |
import UIKit
protocol ViewComponent : AnyObject {
///
func isAncestor(of descendant: Self) -> Bool
///
func isDescendant(of ancestor: Self) -> Bool