Komponents ๐Ÿ“ฆ v0.2.0 Release Notes

Release Date: 2017-05-18 // almost 7 years ago
  • ๐Ÿ— โš ๏ธ v 0.2 ๐Ÿ—

    ๐Ÿฑ Please be aware that this is still very experimental ๐Ÿ”ฌ.
    The actual api can and will change.
    โœ… This is not battle-tested and we advise you against using this in Appstore Apps (for now)

    ๐Ÿฑ Declarative Styling via Props ๐ŸŽจ

    Applying styles directly on the UIKit elements was super handy in v0.1 but came with major strings attached. Indeed, the styles blocks in the nodes could only be called on the main thread , because UIKit is meant to be accessed from the UI Thread (for the most part).
    ๐Ÿ’… Also, in order to compare styles, we needed to create a duplicate UIKit element (heavy) and look for differences on it.

    That's where Props come in!

    ๐Ÿ’… The idea is to have a Props layer, aka a structure that defines an element's style , that is Equatable.
    ๐Ÿ’… Being equatable, it becomes trivial to compare two buttons styles.
    For instance, you can just write :
    ๐Ÿ’… let styleIsTheSame = (button.props == newButton.props)

    Being Value-typed, it is also safe to process the diff in background !

    ๐Ÿ†“ Could we get all this goodness for free? Of course not, welcome to engineering.
    The major drawback is that we have to bridge every UIKit element property to its corresponding Props struct.

    ๐Ÿ‘ However the properties supported can only get better with time classic escape hatch through refs will always be accessible to access UIkit elements if a property is not yet supported.

    This is worth it!

    ๐Ÿฑ A dead-simple declarative layout ๐Ÿ“

    The coming version is switching from Autolayout (and Stevia) to a declarative layout.
    The new layout system is based on a super simple Layout struct, that, combined with classic StackViews enables 99.9% of layout cases.
    It is a value type, meaning it will be thread safe and thus enable comparison in a background thread :)

    ๐Ÿฑ Diffing on the virtual DOM. ๐Ÿš€

    With elements, styling, and layout purely declarative , Value-Type and Equatable , we can now safely put all the heavy duty stuff off to a background thread !!!

    โฑ In v0.2, the diffing algorithm (also known as reconciliation) will run on the virtual DOM, on a background thread and only schedule UI changes on the UI thread. ๐ŸŽ‰