bennyguitar / Colours

A beautiful set of predefined colors and a set of color methods to make your iOS/OSX development life easier.
MIT License
3.09k stars 300 forks source link

Fix rgba() & hsba() for 2-components color spaces in Colours.swift #53

Closed stel closed 8 years ago

stel commented 8 years ago

As stated in NSColor docs for getRed:blue:green:alpha::

This method works only with objects representing colors in the NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace color space. Sending it to other objects raises an exception.

Obj-C implementation uses method swizzling, but swift calls these methods without any checks, so here is a very quick fix.