swift-Protokoll, IBOutlet property kann nicht nicht-Objekt-Typ

Möchte ich Draht, ein eigenes swift-Delegierter in der IB. Der Delegat ist ein Objekt, das implementiert eine bestimmte protocol in swift.

protocol ThumbnailTableViewCellDelegate {
    func cellWasTouched(thumbnail: Bool, cell: UITableViewCell)
}

class ThumbnailTableViewCell: UITableViewCell {
    @IBOutlet var thumbnailTableViewCellDelegate: ThumbnailTableViewCellDelegate?
}

leider, der compiler beschwert sich mit:

error: 'IBOutlet' property cannot have non-object type 'ThumbnailTableViewCellDelegate'
    @IBOutlet var thumbnailTableViewCellDelegate: ThumbnailTableViewCellDelegate?
    ^~~~~~~~~
  • Es ist völlig in Ordnung - du sagst es ist ein Objekt, entspricht, der Protokoll.
InformationsquelleAutor pixbroker | 2014-07-03
Schreibe einen Kommentar