objcio / core-data

Sample code for the objc.io Core Data book
https://www.objc.io/books/core-data
MIT License
769 stars 197 forks source link

Utilities.swift Binary Operator Error #51

Open rouviere opened 6 years ago

rouviere commented 6 years ago

When attempting to run Sample Project Chapter 1.1 and 1.2 I get the following error on the Utilities.swift file:

Binary operator '===' cannot be applied to operands of type 'Self.Element' and 'AnyObject'

There is also a warning on ColorSpaceConversion.swift:

Initializer for struct 'ARGBPixel_s' must use "self.init(...)" or "self = ..." because the struct was imported from C

tkrajacic commented 6 years ago

Have a look at my comment on #48

Hope this helps

EfrenPerez94 commented 6 years ago

As @tkrajacic says you need to change the extension to:

extension Sequence where Element: AnyObject

The type system only checks the Sequence's Element type so it can't establish that every element of the Sequence is also an AnyObject, so changing the extension the type system is not gonna have this problem.

Please check that and if the problem is solved check this issue as complete.