Clicky

iOS Dev Nugget 271 Zhi — Live Reloading Auto Layout Constraints and more

.

Need to run a code review on your codebase? Hire me

I wrote a library for working with Auto Layout in Swift. It lets you tweak Auto Layout constraints and watch your app update immediately without a rebuild + run cycle. It’s called Zhi.

The library allows you to specify your auto layout constraints in separate .styles files. It supports:

  • Live reloading of Auto Layout constraints as you save the .styles files, without a rebuild + run cycle
  • Apple's Visual Format Language: H:[p(==v2)]|
  • Support an equations-based syntax: v1.width = v2.width + 10

In addition, the .styles files also support:

  • Metrics can be specified
  • Colors — rgb(), rgba() or named colors in UIColor, e.g. red
  • Image filenames
  • Button title and label text
  • Font name, size
  • Dynamic type style names, e.g. callout or caption1
  • and more

This means that you can tweak these properties without rebuilding your app during development.

Refer to the README for installation and usage.

Try it out and let me know what you think.

I created a Patreon page. I have been writing iOS Dev Nuggets for more than 5 years. If you want to support me, visit Patreon and consider pledging.

As usual, any tips or comments are welcomed via email.

Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No

.

.

Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter

.

View archives of past issues