2 // NotificationCenterExtension.swift
5 // Created by Hori,Masaki on 2017/10/29.
6 // Copyright © 2017年 Hori,Masaki. All rights reserved.
11 extension NotificationCenter {
13 func addObserverOnce(forName name: NSNotification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) {
15 weak var token: NSObjectProtocol?
16 token = addObserver(forName: name, object: obj, queue: queue) { [weak self] notification in
18 self.map { me in token.map(me.removeObserver) }