Skip to content

Commit

Permalink
Merge pull request #12 from cats-oss/improve-type-inference
Browse files Browse the repository at this point in the history
Improve type inference
  • Loading branch information
marty-suzuki authored Oct 23, 2019
2 parents 1b255f1 + 1ee76bd commit 5d17e82
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Unio/Wrappers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public final class InputWrapper<T: InputType> {
}

/// Accepts `event` and emits it to subscribers via `Input`.
public func accept<U: AcceptableRelay>(_ value: U.Element, for keyPath: KeyPath<T, U>) {
public func accept<U: PublishRelayType>(_ value: U.Element, for keyPath: KeyPath<T, U>) {

self[dynamicMember: keyPath](value)
}

/// Send `event` to this observer via `Input`.
public func accept<U: AcceptableRelay>(for keyPath: KeyPath<T, U>) -> AnyObserver<U.Element> {
public func accept<U: PublishRelayType>(for keyPath: KeyPath<T, U>) -> AnyObserver<U.Element> {

return self[dynamicMember: keyPath]
}
Expand All @@ -48,15 +48,15 @@ public final class InputWrapper<T: InputType> {
/// Accepts `event` and emits it to subscribers via `Input`.
///
/// - note: KeyPath Dynamic Member Lookup is avairable greater than Swift5.1
public subscript<U: AcceptableRelay>(dynamicMember keyPath: KeyPath<T, U>) -> (U.Element) -> Void {
public subscript<U: PublishRelayType>(dynamicMember keyPath: KeyPath<T, U>) -> (U.Element) -> Void {

return _dependency[keyPath: keyPath].accept
}

/// Send `event` to this observer via `Input`.
///
/// - note: KeyPath Dynamic Member Lookup is avairable greater than Swift5.1
public subscript<U: AcceptableRelay>(dynamicMember keyPath: KeyPath<T, U>) -> AnyObserver<U.Element> {
public subscript<U: PublishRelayType>(dynamicMember keyPath: KeyPath<T, U>) -> AnyObserver<U.Element> {

let relay = _dependency[keyPath: keyPath]
return AnyObserver { $0.element.map(relay.accept) }
Expand Down

0 comments on commit 5d17e82

Please sign in to comment.