| ||
What is PickerView? | ||
I’ve built an open-source library written in Swift that allows iOS developers to implement every custom designed UIPickerView and I called it PickerView. It was created to allow customization in every part: color, text style, highlighted text style, custom selection indicator views and images and infinite/default scrolling. | ||
Why? | ||
Some months ago one customer of mine challenged me to build a totally custom UIPickerView from scratch. Well, challenge accepted! | ||
How? | ||
I started out validating how I could build an UIPickerView on top of an UITableView. I’ve searched for some libs that already have done this work, but all of them are strongly based on images. I would like to have a more independent solution, which could be done only with custom text attributes and UIViews. So I did a mix of all custom pickers that I found and add the behavior to be highly customizable and then voilá: On the first day I presented my proof of concept. | ||
The greatest challenge after making the proof of concept to work was a memory leak which happened when presenting the PickerView inside a modal. The PickerView set-up was dropping some frames from the modal transition animation, but after hours of debugging and fixing, it worked like a charm. | ||
As soon as I could solve the memory leaks, I focused on adding up more customizable attributes such as the possibility to have infinite scrolling, image overlay and UIView overlay. | ||
Conclusion | ||
We’ve implemented PickerView on the project and the customer was delighted with the result: Mission complete! | ||
Want to know more about PickerView? | ||
You can find it out on GitHub with all the instructions to implement in your project, and install through CocoaPods. If you liked this post, please, share the love and recommend it to your network :) | ||
Feel free to get in touch with me, and enjoy PickerView! |