Skip to content
App and builder classes to help you build iOS layouts
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LayoutHelperApp.xcodeproj
LayoutHelperApp
.gitignore
README.md
screenshot.jpg

README.md

LayoutHelperApp

With this app you can code and quickly debug your layouts before adding them to your app.

The app is meant to be run on an iPad so you can preview the layout in different sizes with the resizable container view.

Edit PreviewController.swift and configure your layout there.

You may use util classes like LayoutBuilder and LinearBuilder.

Those classes let you build layouts using the Visual Format Language with extra features to make it much easier. Example:

        let row = LinearBuilder(axis: .horizontal) // similar to Android's LinearLayout
            .margin(between: 5)
            .addViews([subtitle, icon])
            .wrapContent(view: icon) // similar to Android's wrap_content
            .getView()

        let view = LayoutBuilder()
            .addViews(["title":title, "row":row])
            .addConstraints([
                "V:|-[title]-[row]-|",
                "H:|-[row]-|",
                "X:title.centerX == parent.centerX"  // extra constraint format, supported by LayoutBuilder
            ])
            .view

You can see the complete code in PreviewController.swift.

If run the app you will see something like this:

You can’t perform that action at this time.