/Dizzy

Like a UIActivityIndicatorView, but with a customizable image; configurable in Interface Builder

Primary LanguageSwiftMIT LicenseMIT

Dizzy

I was way late on reading-up about IBInspectable and IBDesignable, so I started playing around with them. One thing led to another, which led to this thing. Turns out they are pretty awesome time savers and I/we/you/me should use them more often! So, for those of you who want to learn, or are looking for a UIActivityIndicatorView that can take a custom image, here is…

A Dizzying Custom Activity Indicator, Configurable through Interface Builder

A UIActivityIndicatorView -inspired UIView that allows you to set a custom image for the indicator. It takes advantage ofIBInspectable and IBDesignable attributes (available since XCode 6,) which allows you to configure this indicator with your custom image and preview it in Interface Builder — including color changes — without having to first compile and run the app.

Using DizzyActivityIndicatorView

  1. Drop a UIView into your storyboard and then change its class to DizzyActivityIndicatorView

  2. You can then configure its image and UIActivityIndicatorViewstyle attributes, like isAnimating and hidesWhenStopped Dizzy Interface Builder Demo

  3. You can even change the color, and see it change in Interface Builder!

    Changing the Color

  4. The DizzySample application target provides a concrete example of how to use this class.

    Dizzy Sample Application Demo

Installation

It's one file, so it's easiest to just drop DizzyActivityIndicatorView.swift into your XCode project via a clone+copy or even a submodule reference (but if you're really hunkering for some kind of dependency manager support, then file an issue and let's work together on it!)

Thanks

Thanks to @fabb for this gist: https://gist.github.com/fabb/007d30ba0759de9be8a3, which helped to make adding color support an easy task.