UIViewKit is an iOS framework that makes writing, previewing, and debugging UIViews programmatically in a Swift-like way.
Thanks to DSL, the UIView definition looks like Xib, Storyboard source code, or SwiftUI View, making the user interface feel familiar.
Included with framework tools like FreeForm Previews, it gives instant visualization for different view sizes.
The idea behind the framework is to provide as much experience as possible in writing views, like dragging and dropping views in Interface Builder.
Those using the kit can make the most out of the framework to recreate the user experience of creating UIViews in Xcode Interface Builder but with Swift DSL code.
It helps to write Swift Compiler-typed UIView hierarchy code programmatically, which, compared to linear UIView hierarchy code, is easy to reason about.
UIView hierarchy, configuration, and refactoring are as easy as SwiftUI code, which is one of the standout features.
Key Features
- DSL
- Previews
- Debug
- Constraints
- ViewController
Pros & Cons
| Pros | Cons |
| Write and configure views programmatically in a hierarchical style in a Swift-like way. | iOS Developer team members must learn how UIKit Storyboard changes the default values of UIViews compared with those created in the code. |
| A collection of specialized previews, FreeForm Preview helps to visualize a view in different sizes, as Interface Builder does. | |
| Functions that print view subview hierarchies, set colors, or activate borders on subviews to make them easily spotted. | |
| Similar to the Interface Builder Constraints generator. A one-liner, powerful constraints generator. |
Pricing & Plans
The framework is open-sourced under the MIT license. Therefore, UIViewKit is free to use and has very few modification and code redistribution restrictions. You don’t need to worry about the app purchase on the app store.
Conclusion
UIViewKit combines the familiarity of Interface Builder with the power of Swift DSL, making it easy to write, preview, and debug UIViews programmatically. Its clear syntax, FreeForm Previews, and handy debug tools help you build maintainable, compiler-typed UI code that’s simple to refactor — just like SwiftUI, but for UIKit.
Open-source and free under the MIT license, UIViewKit lets you recreate the Interface Builder experience in code, with no cost or restrictions. If you want clean, flexible UIKit views without Storyboards, UIViewKit is an effortless choice.
