Skip to content

Ready to beat SwiftUI

Choose a tag to compare

@MihaelIsaev MihaelIsaev released this 27 Mar 18:37
· 359 commits to master since this release

Hurray, I made UIKitPlus even more powerful than before! It is updated to Swift 5.2 and Xcode 11.4!

For those who doesn't know what is UIKitPlus

It is complex production-ready solution for easy building amazing UI on UIKit.
This is a UIKit-wrapper which makes is declarative, allows to add subviews in SwiftUI style, and gives the most beautiful way to declare constraints! So no more need in SnapKit or its clones! Even more, constraints may be set in advance anywhere, so before you add view to superview! 🚀

You can start using it today even for one or two views. Just try it and you will never want to go back! 🤷

I refactored and updated EXAMPLE PROJECT so now LivePreview works in every file just like in SwiftUI!

In the library's readme you will find detailed examples for everything, bu here I want to highlight some awesome bonus features:

  • easily declare dynamic colors for dark/light modes
let titleColor: UIColor = .black / .white // second color is for dark mode (works automatically ofc)
  • root view controller
    This view controller you could use as enter point to the app and inside it declare routes to other view controllers and its transitions. It gives an ability to easily switch between controllers and support deep links.
    Documentation is here

  • localize your strings easily

String(.en("Hello"),
       .fr("Bonjour"),
       .ru("Привет"),
       .es("Hola"),
       .zh_Hans("你好"),
       .ja("こんにちは"))
  • build attributed strings easily
"Hello".foreground(.darkGrey).font(.articoRegular, 15)
  • and even concatenate them easily
"Hello ".foreground(.green).font(.articoRegular, 15) + "world".foreground(.red).font(.articoRegular, 15)
static var phone: TextField {
    TextField()
        .content(.telephoneNumber)
        .autocapitalization(.none)
        .autocorrection(.no)
        .keyboard(.phonePad)
        .font(.articoRegular, 15)
        .placeholder("(555) 123-4567".foreground(.darkGrey).font(.articoRegular, 15))
        .color(.blackHole)
        .height(18)
        .formatCharacters { textView, range, text in
            // here we use `AnyFormatKit`
            let phoneFormatter = DefaultTextInputFormatter(textPattern: "(###) ###-####")
            let result = phoneFormatter.formatInput(currentText: textView.text ?? "", range: range, replacementString: text)
            textView.text = result.formattedText
    }
}

and even more cool, beautiful and convenience features ❤️ because I'm writing this lib for myself and just would love to share it with you 😃

If you will use it please don't hesitate to ask me any questions! I'm ready to help with anything!

You have a lot of ways to get help: