File tree Expand file tree Collapse file tree 1 file changed +1
-34
lines changed
Sources/Sharing/SharedKeys Expand file tree Collapse file tree 1 file changed +1
-34
lines changed Original file line number Diff line number Diff line change 451
451
store. wrappedValue. addObserver ( observer, forKeyPath: key, context: nil )
452
452
removeObserver = { store. wrappedValue. removeObserver ( observer, forKeyPath: key) }
453
453
}
454
- let willEnterForeground : ( any NSObjectProtocol ) ?
455
- if let willEnterForegroundNotificationName {
456
- willEnterForeground = NotificationCenter . default. addObserver (
457
- forName: willEnterForegroundNotificationName,
458
- object: nil ,
459
- queue: . main
460
- ) { _ in
461
- subscriber. yield ( with: . success( lookupValue ( default: context. initialValue) ) )
462
- }
463
- } else {
464
- willEnterForeground = nil
465
- }
466
- return SharedSubscription {
467
- removeObserver ( )
468
- if let willEnterForeground {
469
- NotificationCenter . default. removeObserver ( willEnterForeground)
470
- }
471
- }
454
+ return SharedSubscription ( removeObserver)
472
455
}
473
456
474
457
public func save( _ value: Value , context _: SaveContext , continuation: SaveContinuation ) {
676
659
}
677
660
}
678
661
679
- private let willEnterForegroundNotificationName : Notification . Name ? = {
680
- #if os(macOS)
681
- return NSApplication . willBecomeActiveNotification
682
- #elseif os(iOS) || os(tvOS) || os(visionOS)
683
- return UIApplication . willEnterForegroundNotification
684
- #elseif os(watchOS)
685
- if #available( watchOS 7 , * ) {
686
- return WKExtension . applicationWillEnterForegroundNotification
687
- } else {
688
- return nil
689
- }
690
- #else
691
- return nil
692
- #endif
693
- } ( )
694
-
695
662
#if DEBUG
696
663
private let suites = Mutex < [ String : ObjectIdentifier ] > ( [ : ] )
697
664
#endif
You can’t perform that action at this time.
0 commit comments