Skip to content

Instantly share code, notes, and snippets.

@hachinobu
Created May 12, 2015 07:18
Show Gist options
  • Save hachinobu/f195a286b5f891a3fb90 to your computer and use it in GitHub Desktop.
Save hachinobu/f195a286b5f891a3fb90 to your computer and use it in GitHub Desktop.
Optional Bindingによる開示

navigationController?.toolbarHidden = false
// let hiddenはnil判定かつOptionalの開示された変数なのでwhereがないと条件が真になってしまう
if  let hidden = navigationController?.toolbarHidden where isbar {
	println(hidden)
}
else {
	println(hidden)
}

//インスタンスがどのクラスのものか判定の仕方
if navigationController?.visibleViewController is UIViewController {
	println(navigationController?.visibleViewController)
}
else {
	println(navigationController?.visibleViewController)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment