Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed Nov 14, 2024
1 parent 6d75c39 commit f12bd7f
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions Sources/PerceptionCore/PerceptionRegistrar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,19 @@ extension PerceptionRegistrar {
_ subject: Subject,
keyPath: KeyPath<Subject, Member>
) {
if #available(iOS 17, macOS 14, tvOS 17, watchOS 10, *), !isObservationBeta,
let subject = subject as? any Observable
{
func `open`<S: Observable>(_ subject: S) {
return self.registrar.willSet(
subject,
keyPath: unsafeDowncast(keyPath, to: KeyPath<S, Member>.self)
)
#if canImport(Observation)
if #available(iOS 17, macOS 14, tvOS 17, watchOS 10, *), !isObservationBeta,
let subject = subject as? any Observable
{
func `open`<S: Observable>(_ subject: S) {
return self.registrar.willSet(
subject,
keyPath: unsafeDowncast(keyPath, to: KeyPath<S, Member>.self)
)
}
return open(subject)
}
return open(subject)
}
#endif
return self.perceptionRegistrar.willSet(subject, keyPath: keyPath)
}

Expand All @@ -164,17 +166,19 @@ extension PerceptionRegistrar {
_ subject: Subject,
keyPath: KeyPath<Subject, Member>
) {
if #available(iOS 17, macOS 14, tvOS 17, watchOS 10, *), !isObservationBeta,
let subject = subject as? any Observable
{
func `open`<S: Observable>(_ subject: S) {
return self.registrar.didSet(
subject,
keyPath: unsafeDowncast(keyPath, to: KeyPath<S, Member>.self)
)
#if canImport(Observation)
if #available(iOS 17, macOS 14, tvOS 17, watchOS 10, *), !isObservationBeta,
let subject = subject as? any Observable
{
func `open`<S: Observable>(_ subject: S) {
return self.registrar.didSet(
subject,
keyPath: unsafeDowncast(keyPath, to: KeyPath<S, Member>.self)
)
}
return open(subject)
}
return open(subject)
}
#endif
return self.perceptionRegistrar.didSet(subject, keyPath: keyPath)
}
}
Expand Down

0 comments on commit f12bd7f

Please sign in to comment.