DCKit: how to convert Xcode IB to WYSIWYG-editor

Andrey Gordeev
2 min readFeb 10, 2016

--

I’m keep looking for ways of making the process of creating iOS apps a bit simpler and faster. I’m also trying to avoid code related to UI elements as much as possible, and move this effort to Xcode Interface Builder. Fortunately, Xcode offers some nice possibilities for this.

I created a useful set of UI controls called DCKit. They use IBInspectable/IBDesignable features Apple introduced earlier in Xcode 6. DCKit gives you much more powerful controls than a standard UIButtons/UITextFields etc. Using DCKit you would be able to modify a control’s properties, which are not exposed to Interface Builder in usual cases.

E.g. it’s a common case when you need to create a bordered text field, or change placeholder’s text color. With DCKit, you would be able to do this with 2 clicks:

Here is a video for further reference:

No need to write boilerplate code in your view controllers anymore! DCKit will handle this for you.

This library includes many useful controls, but there are couple essentials, widely used in my projects:

DCHairlineView

This view allows you to draw a thin line under a section of controls:

It has a customizable thickness and color.

DCMandatoryTextField

Very often we want the user to enter a value before he can proceed. DCMandatoryTextFields have isValid() method, which changes border color to red (or whatever you specify) if the field is empty.

DCMandatoryEmailTextField

This is a subclass of DCMandatoryTextField. It checks a value the user is entering, and if it doesn’t match the email regexp, it changes border color to red on the fly.

The library is absolutely free for use and available on Github: https://github.com/andrew8712/DCKit. Contributors are welcomed!

DCKit helps Xcode to be more WYSIWYG-like. From my experience, this speeds up the development process! ;-)

--

--

Andrey Gordeev
Andrey Gordeev

Responses (3)