の正しい宣言を入力したにもかかわらず、このメッセージが表示され続けるのはUITableViewRowAction
なぜですか?
var shareAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Share",
handler: { (action:UITableViewRowAction!, indexPath: NSIndexPath) -> Void in
の正しい宣言を入力したにもかかわらず、このメッセージが表示され続けるのはUITableViewRowAction
なぜですか?
var shareAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Share",
handler: { (action:UITableViewRowAction!, indexPath: NSIndexPath) -> Void in
Xcode 6.4 のドキュメントには、両方のパラメーターが暗黙的にラップ解除されたオプションである必要があると記載されています。
var shareAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Share",
handler: { (action: UITableViewRowAction!, indexPath: NSIndexPath!) -> Void in
または Xcode 7 では、どちらのパラメーターもオプションではありません。
var shareAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Share",
handler: { (action: UITableViewRowAction, indexPath: NSIndexPath) -> Void in
いずれにせよ、あなたは試してみるべきです
var shareAction = UITableViewRowAction(style: .Default, title: "Share") {
action, indexPath in
/* ... */
}
これは、より迅速な方法です。