TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2016 |
SwiftSwift Version | 2.3 |
SPMSupports SPM | ✗ |
Maintained by Lammert Westerhoff.
BoxesView is a UIView for iOS that lays out subviews as boxes, much like a simplified version of a UICollectionView.
It completely layed out using auto layout constraints and therefore fits in modern apps. It's a simplified version of a UICollectionView
that doesn't need any delegate or data source. You just configure the number of columns you want and set the views that you want to be displayed in boxes.
BoxesView is available through CocoaPods. To install it, simply add the following line to your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod "BoxesView"
Then, run the following command:
$ pod install
To run the example project, clone the repo, and run pod install
from the Example directory first.
Use the BoxesView
in your project as you would use any other UIView
. For example in a Storyboard. The BoxesView has an intrinsic height so you do not have to specify a height for it (although you can give it a explicit height). The simple assign the boxes views to it:
@IBOutlet weak var boxesView: BoxesView! {
didSet {
boxesView.boxes = [
view1,
someImageView,
view2
]
}
}
The boxes will be layed out in a similar fashion as in a Collection View.
There are a few options available to a BoxesView. These are all variables with @IBInspectable
and thus can be set in your Storyboard.
This library depends on SnapKit to create the necessary auto layout constraints.
Lammert Westerhoff, [email protected]
BoxesView is available under the MIT license. See the LICENSE file for more info.