Our DNA is written in Swift


I wanted to use a UISwitch in iWoman to select between Celsius and Fahrenheit for the temperature scale. UISwitch being in my humble opinion the quickest method to switch between two values. Unfortunately Apple does not give us any kind of customization capability.

Homick tried to fill this need by making a custom view and providing a photoshop file that you could change. But that’s not how we do things in Dr. Touchistan. I totally revamped Homick’s code and brought it up to snuff to what I needed. Most importantly the color and labels needed to be fully customizable IN CODE.

DTCustomSwitch is almost entirely written from ground up as a UIControl where you can customize the text and looks of of both labels as you please. Even set the background color. That so far fulfills my needs for iWoman 2.0, but if you have any ideas on how to even more customize it, let me know.

Peter Steinberger informed me that you can also drag the knob for sort of a “slow switching”, something I had not thought about initially. But so I spent a couple of hours honing the animation behavior to get as close to the original as possible. Now DTCustomSwitch even does that.

DTCustomSwitch will available via the Dr. Touch’s Parts Store for 50 Euros.

Categories: Parts

Leave a Comment

%d bloggers like this: