Posts

Showing posts from 2018

Simple Events in Swift

Events are useful when you need more than one delegate or event handler. Here is a simple class that can be used to manage events:




Use the uiSubscribe and uiUnsubscribe to have the Event class automatically run the event handler on the main DispatchQueue (for GUI related stuff). Here is an example of how to use them:

UIColor Extension for RGBA Hex and HSLA

Here is an extension for UIColor that I've found useful when working with Photoshop and Web designers. It allows you to specify a UIColor in RGBA hex or HSLA.