Created
July 1, 2016 07:06
-
-
Save yutailang0119/9143bb094e576e1e8abc274938914052 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//例えばUITableViewの更新 | |
@IBOutlet weak var tableView: UITableView! | |
let str = "hoge" | |
// 1 | |
let complete1 = { [weak self]() in | |
if let weakSelf = self { | |
print(weakSelf.str) // プロパティにアクセスする => str | |
weakSelf.tableView.reloadData() // メソッドを使う | |
} | |
} | |
// 2 | |
let complete2 = { [weak self]() in | |
print(self?.str) // プロパティにアクセスする => Optional("hoge") | |
self?.tableView.reloadData() // メソッドを使う | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment