Awesome Open Source
Awesome Open Source

SweetUI 🍯

SwiftUI-like declarative UIKit based framework.

SwiftUI is great but still lacks some useful features of UIKit and doesn't support older versions of iOS. This framework will allow you to use UIKit in a declarative way, pretty similar to the SwiftUI, but with support of iOS 10+ and well-known behavior of the system.



import SweetUI

class ViewController: UIViewController {
    private(set) var button: UIButton?

    override func viewDidLoad() {
        // Setup view
        view.ui.add {
          	// Add title
            UILabel(text: "Jumping button", alignment: .center, color: .red).ui
                .font(.systemFont(ofSize: 32, weight: .semibold))
                .center(.init(x:, y: - 60))
                .size(.init(width: CGRect.screen.width, height: 32))
          	// Add button
            UIButton(title: "Tap me!") { [weak self] in
                print("The button was tapped.")
                let position0 = self?.button?.center ?? .zero
                let position1 = CGPoint(x: position0.x, y: position0.y - 32)
                    .animate(.sequence,								// Perform one by one
                             .move(center: position1, // Jump up
                                   duration: 0.1),
                             .move(center: position0, // Fall down
                                   duration: 0.1))
                .link(to: &button) // Store UIButton in self.button
                .title(color: .blue)
                .size(.init(width: 100, height: 32))

(Working on new features and documentation)


SwiftUI provides custom convenience initializers for your views.


SweetUI provides some proxies for interaction with your view's properties. You can access these DSLs via SomeView.ui property, which returns a ViewProxy or it's successor's instance.


SweetUI provides some proxies for interaction with your view's properties. You can access these DSLs via SomeView.layout or SomeViewProxy.layout property, which returns a LayoutProxy or it's successor's instance.


  • ⌨️ XCode12+
  • 📱 iOS 10.0+


SUILayout is available through SwiftPM

.package(url: "", from: "1.0.0-beta.3.7")
.product(name: "SweetUI", package: "SweetUI")


SweetUI is available under the MIT license. See the LICENSE file for more info.


  • Conditional building ✅
  • Add DSL's for every UIView subclass.
  • Add convenience methods for user interaction, such as tapAction(_ execute: () -> Void)
  • Complete Xcode documentation.
  • Provide more examples.
  • Add API for shadows. ✅
  • Add more animation templates. ✅
  • Add layout engine. ✅
  • Make some API improvements.
  • Provide DSLs for UIViewControllers.
  • Mix sequential and parallel animations.

Feel free to contribute or communicate. SweetUI is open to your ideas. 🌝

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Swift (65,800
Proxy (24,698
Dsl (5,471
Interaction (4,630
Swiftui (2,248
Declarative Ui (129
Declarative Programming (68
Xcode11 (66
Swift5 1 (31