Latest 0.1.1
Homepage https://github.com/lammertw/BoxesView
License MIT
Platforms ios 8.0, requires ARC
Dependencies SnapKit
Authors

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.

Screenshot 1
Screenshot 2

Version
License
Platform

Requirements

  • Swift 2.0
  • iOS 8.0+
  • Xcode 7.2+

Installation

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

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Add to your project

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.

Options

There are a few options available to a BoxesView. These are all variables with @IBInspectable and thus can be set in your Storyboard.

  • [x] columns Determines the number of columns that your BoxesView should have. Defaults to 2
  • [x] rowHeight Use this to specify a fixed row height. If you specify -1 (which is the default) your box views need to have an (intrinsic) height and the row height will be determined by the box in the row with the greatest height.

Dependency

This library depends on SnapKit to create the necessary auto layout constraints.

Author

Lammert Westerhoff, [email protected]

License

BoxesView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "BoxesView",
    "version": "0.1.1",
    "summary": "A UIView layed out in boxes",
    "description": "BoxesView is a UIView that lays out subviews as boxes, much like a simplified version of a UICollectionView",
    "homepage": "https://github.com/lammertw/BoxesView",
    "screenshots": [
        "http://i.imgur.com/D7IqjMW.png",
        "http://i.imgur.com/wuWclAX.png"
    ],
    "license": "MIT",
    "authors": {
        "Lammert Westerhoff": "[email protected]"
    },
    "source": {
        "git": "https://github.com/lammertw/BoxesView.git",
        "tag": "0.1.1"
    },
    "social_media_url": "https://twitter.com/lwesterhoff",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "dependencies": {
        "SnapKit": [
            "0.22.0"
        ]
    },
    "pushed_with_swift_version": "2.3"
}

Pin It on Pinterest

Share This