2

I've implemented ==, <, > funcs as NSDate extension. The code itself is working well. The problem starts in unit tests, where I use Quick & Nimble and one of these must also have implemented the given protocol. What can I do now? Protocol is public, both the library and my code implements it, so it obviously generates an error.

The error itself: Redundant conformance of 'NSDate' to protocol 'Comparable'.

-- edit -- Just a side note to clarify: I cannot remove the implementation in my classes, because I do not want to import Quick/Nimble in non-test targets.

-- edit -- I'm using Swift 2.2. Comparable code is basically equal to: https://stackoverflow.com/a/28109990/849616.

Community
  • 1
  • 1
Nat
  • 12,032
  • 9
  • 56
  • 103
  • post your code implementation and Swift version you are using. BTW you don't need to implement == NSDate conforms to Equatable. No need to implement greater than `>`. Check this answer http://stackoverflow.com/a/34487822/2303865 – Leo Dabus Jun 14 '16 at 21:32
  • @LeoDabus I've answered your questions as an edit in the question. The answer you linked does override `>` operator for comparing dates, the same way as I do it. Thanks for side note, but anyway, I'd like to stick firstly with my issue :). – Nat Jun 14 '16 at 21:52

0 Answers0