Skip to content

Commit

Permalink
Public init for PropertyObservable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Usbergo committed Oct 31, 2021
1 parent 06f6cd9 commit 93adb2d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/Primer/PropertyObservable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public struct AnyPropertyChangeEvent {
/// Optional debug label for this event.
public let debugLabel: String?

public init(object: Any, keyPath: AnyKeyPath? = nil, debugLabel: String? = nil) {
self.object = object
self.keyPath = keyPath
self.debugLabel = debugLabel
}

/// Returns the tuple `object, value` if this property change matches the `keyPath` passed as
/// argument.
public func match<T, V>(keyPath: KeyPath<T, V>) -> (T, V)? {
Expand Down

0 comments on commit 93adb2d

Please sign in to comment.