Latest 0.2.2
License MIT
Platforms ios 8.0, requires ARC


Easily embed any ViewController in a Collection/Table View Cell.

Basic Usage

To take advantage of this library there are a few steps that you need to follow:


Start by creating a cell that extends from ViewControllerCollectionCell and parameterize it with the ViewController that you intend to present.

class MyCollectionCell: ViewControllerCollectionCell<ViewController> {
  override func instantiateViewController() -> ViewController? {
    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let vc = storyboard.instantiateViewControllerWithIdentifier("ViewC") as! ViewController
    return vc


Then register your cell.

override func viewDidLoad() {

    // Register cell classes
    self.collectionView!.registerClass(MyCollectionCell.self, forCellWithReuseIdentifier: reuseIdentifier)

And set the current view controller as parent view controller.

override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {

    let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath)

    if let cell = cell as? MyCollectionCell {
      cell.parentViewController = self
      cell.viewController?.model = model[indexPath.item]

    return cell


As the main purpose of this library is to be used with UICollectionViewControllers or UITableViewControllers it provides already some base classes like ViewControllerCollectionCell and ViewControllerTableCell. But it can be used to bind any view to any view controller by making the desired view implement the BindableView protocol.


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


BindViewControllerToView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "BindViewControllerToView"


Francisco Gonçalves, @franciscocsg


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

Latest podspec

    "name": "BindViewControllerToView",
    "version": "0.2.2",
    "summary": "Easily embed any ViewController in a Collection/Table View Cell.",
    "description": ""This library allows you to embed any ViewController in any view."n"Its main purpose is to allow embeding View Controllers in Cells by providing Collection/TableViewCell base classes that you can extend."",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Francisco Goncu0327alves": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.2.2"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "BindViewControllerToView": [
    "libraries": "xml2",
    "xcconfig": {
        "HEADER_SEARCH_PATHS": "$(SDKROOT)/usr/include/libxml2"

Pin It on Pinterest

Share This