0
1

More than 3 years have passed since last update.

[事例報告] Instance method ‘didTapMessage(in:)’ nearly matches defaulted requirement ‘didTapMessage(in:)’ of protocol ‘MessageCellDelegate’

Posted at

本事例はMessageKitで起きた問題ですが、一般に起こりうるのでメモしておきます。

下記のようなプロトコルがあり

public protocol MessageCellDelegate: MessageLabelDelegate {
 func didTapMessage(in cell: MessageCollectionViewCell)
}

public extension MessageCellDelegate {
  func didTapBackground(in cell: MessageCollectionViewCell) {}
}

これを実装しようとすると

Instance method didTapMessage(in:) nearly matches defaulted requirement didTapMessage(in:) of protocol MessageCellDelegate

と怒られます。

原因がはMessageKitで用意されているMessageCollectionViewCellと同じ名前のMessageCollectionViewCellというクラスを
別にアプリ内で定義していたからでした。

気づきにくいバグでした。ご注意を‥。

0
1
1

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
0
1