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 451451 store. wrappedValue. addObserver ( observer, forKeyPath: key, context: nil )
452452 removeObserver = { store. wrappedValue. removeObserver ( observer, forKeyPath: key) }
453453 }
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)
472455 }
473456
474457 public func save( _ value: Value , context _: SaveContext , continuation: SaveContinuation ) {
676659 }
677660 }
678661
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-
695662 #if DEBUG
696663 private let suites = Mutex < [ String : ObjectIdentifier ] > ( [ : ] )
697664 #endif
You can’t perform that action at this time.
0 commit comments