本事例は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というクラスを
別にアプリ内で定義していたからでした。
気づきにくいバグでした。ご注意を‥。