Skip to content
Dynamic iOS view container using UIStackView
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
StackGrid-iOS Adds carthage compatibility Nov 20, 2017
StackGrid.xcodeproj Update project (Swift 5 et al) May 12, 2019
StackGrid Update project (Swift 5 et al) May 12, 2019
docs Adding implementation readme file + image resources Sep 30, 2015
.gitignore Adding gitignore, ignoring userdata Sep 12, 2015
LICENSE adding MIT license Sep 30, 2015 README updates Nov 20, 2017


StackGrid is a dynamic view container, which automatically distributes views according to available space. The end result looks something like this:


It is based on UIKit's UIStackViews, nesting them into each other to achieve the desired result. To read more about the implementation read



The easiest way to get started with StackGrid is to use Carthage. Simply add

github "VFUC/StackGrid" to your Cartfile.

For further Carthage instructions, check out how to add a Carthage framework to your project here.

Manual Copy

Clone the repository somewhere or download it as ZIP archive. Add the files StackGrid.swift and StackGrid-Extensions.swift to your project.


Using StackGrid is easy - after instatiation the following methods are used to set and alter the grid's views:

let grid = StackGrid()

let aSingleView = UIView()
let multipleViews = [UIView(), UIView(), UIView()]

// Sets views to be displayed, overwrites all current views

// Appends view to the end of the current view stack

// Appends multiple views

// Removes view from grid for a given index
grid.removeGridView(at: 1)

// Removes last view from grid

// Set the root node orientation
// Vertical works best on screens with portrait-like dimensions, horizontal for landscape ones
You can’t perform that action at this time.