What does this mean: "The property type" JSQMessagesCollectionView "is incompatible with the type" UICollectionView "inherited from" UICollectionViewLayout ",

I am currently encoding an iOS application in Swift, and I am using some things like JSQMessages and JSQSystemSoundPlayer in Objective C.

When I introduced them in my code, I had Xcode 6.2 and it worked perfectly. I downloaded Xcode 6.3.4 to use Swift 1.2, but now I have 40 warnings like:

"Property type" JSQMessagesCollectionView "is incompatible with the type" UICollectionView "inherited from" UICollectionViewLayout ""

I already created a Bridging Header header to call Objective-C files.

Thank you so much

+4
source share
2 answers

Following the comments, here is an explanation of what this warning is.

Xcode 6.3 has an updated compiler toolchain that is more rigorous, so you see more warnings in general, including this one.

Here the class JSQMessagesCollectionViewFlowLayoutdeclares a property whose definition contradicts the definition of a superclass:

@property (readonly, nonatomic) JSQMessagesCollectionView *collectionView;

While in the superclass, UICollectionViewLayoutit is declared as:

@property(nonatomic, readonly) UICollectionView *collectionView;

Objective-C does not support the covariance property , and this override is a misuse of the Jesse language. The class JSQMessagesCollectionViewFlowLayoutmust provide an additional property related to the type of the subclass.

+3

, @property (readonly, nonatomic) JSQMessagesCollectionView *collectionView; JSQMessagesCollectionViewFlowLayout.h JSQMessagesCollectionViewFlowLayout.m

0

All Articles