「SwiftでCocoa Bindingを使う」の版間の差分

提供: MonoBook
ナビゲーションに移動 検索に移動
 
11行目: 11行目:
  
 
== プロパティ ==
 
== プロパティ ==
プロパティはdynamicを付けないと変更が反映されない。
+
プロパティは「dynamic」を付けないと変更が反映されない。
  
 
; Binding Inspector
 
; Binding Inspector

2023年11月21日 (火) 09:51時点における最新版

swiftCocoa Bindingを使用するには「@objc」をつける。

メソッド[編集 | ソースを編集]

Binding Inspector
  • Model key Path = self
  • Selector = メソッド名
Swift
@objc func メソッド名() {
}

プロパティ[編集 | ソースを編集]

プロパティは「dynamic」を付けないと変更が反映されない。

Binding Inspector
  • Model key Path = self.プロパティ名
Swift
@objc dynamic var プロパティ名:Bool = false