LoginSignup
42
43

More than 5 years have passed since last update.

SwiftでDelegateパターン

Last updated at Posted at 2014-06-04

初Qiitaなんでフォーマットとか崩してたらすいません

Swiftでのdelegateパターン

宣言

@objc protocol delegateName {    
    optional func delegateMethodName(name1: Int) -> Int
}

呼び出し元

let hoge = delegate?.delegateMethodName?(0)

呼び出される側

func delegateMethodName(name1: Int) -> Int{    
    return 0
}
42
43
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
42
43