A DSL-based layout builder for iOS AutoLayout that enables rapid UI construction in code, faster than Interface Builder.
MondrianLayout is a Swift library that provides a declarative Domain-Specific Language (DSL) for building AutoLayout constraints in iOS applications. It enables developers to describe UI layouts using a SwiftUI-like syntax directly in code, offering a faster and more maintainable alternative to Interface Builder (XIBs and Storyboards). The library solves the problem of verbose and error-prone manual constraint code by making layout declarations intuitive and ergonomic.
iOS developers building UIKit-based applications who want to create UI layouts programmatically with AutoLayout but find the native API or Interface Builder cumbersome. It's particularly useful for teams prioritizing code-based UI, maintainability, and rapid iteration.
Developers choose MondrianLayout because it combines the full power of AutoLayout with a modern, declarative API that significantly reduces boilerplate. Its dual API approach—offering both a structured DSL for common layouts and a classical API for complex cases—provides flexibility without sacrificing ease of use, making it a practical alternative to SwiftUI for existing UIKit projects.
🏗 A way to build AutoLayout rapidly than using InterfaceBuilder(XIB, Storyboard) in iOS.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides a SwiftUI-like API for describing layouts, making AutoLayout code more readable and maintainable, as shown in the VStackBlock and HStackBlock examples.
Eliminates manual `addSubview` calls by automatically adding subviews based on layout descriptions, reducing boilerplate and errors.
Offers both a structured DSL for common layouts and a classical chainable API for fine-grained control, catering to different complexity levels.
Includes modifiers like .padding, .background, and safe area support, simplifying common layout adjustments without extra code.
The README admits the API is still being optimized and brushed up for stability, indicating potential breaking changes or lack of maturity.
Does not support SwiftUI, making it irrelevant for projects adopting Apple's newer UI framework and limiting future-proofing.
Acknowledges that the DSL might not describe every layout pattern, requiring fallback to the classical API, which can disrupt the declarative workflow.