NotificationCenter → Publisher
let myNotification = Notification.Name("MyNotification")
let publisher = NotificationCenter.default
.publisher(for: myNotification, object: nil)
_ = publisher
.sink { _ in
print("Receieved Noti")
}
let center = NotificationCenter.default
center.post(name: myNotification, object: nil) // noti 발행
Swift
복사