ざっくり。
NotificationCenterが何を表しているか
NSObject
を継承した通知を扱うNotificationCenter
クラス
.defaultが何を表しているか
class
変数、NotificationCenter
オブジェクトを取得できます。
.postが何を表しているか
メソッド名です。
()の中はどういうことか
メソッドに渡す引数、この場合はNSNotification.Name
型とAny?
型の2つを引数にとっています。
それが何なのか調べる方法
※まずはSwiftの基本的なところからググって勉強していくことをオススメします。
swfit
1/**************** Notification Center ****************/
2open class NotificationCenter : NSObject {
3
4
5 open class var `default`: NotificationCenter { get }
6
7
8 open func addObserver(_ observer: Any, selector aSelector: Selector, name aName: NSNotification.Name?, object anObject: Any?)
9
10
11 open func post(_ notification: Notification)
12
13 open func post(name aName: NSNotification.Name, object anObject: Any?)
14
15 open func post(name aName: NSNotification.Name, object anObject: Any?, userInfo aUserInfo: [AnyHashable : Any]? = nil)
16
17
18 open func removeObserver(_ observer: Any)
19
20 open func removeObserver(_ observer: Any, name aName: NSNotification.Name?, object anObject: Any?)
21
22
23 @available(iOS 4.0, *)
24 open func addObserver(forName name: NSNotification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Swift.Void) -> NSObjectProtocol
25}