One Quickie


Doing Notifications Swiftstyle (Swift->Random)
Posting end
   NotificationCenter.default.post(name: Notification.Name("FishBattery"), object: tour)
Receiving end
NotificationCenter.default.addObserver(
    forName: Notification.Name("FishBattery"),
    object: tour,
    queue: OperationQueue.main) { [weak self] notification in
        guard let tour = notification.object as? Tour else {
            return
        }
        if tour == self?.tour {
            self?.uploadIfNeeded()
        }
    }



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com