     }
     
     private func configureCell(cell: UICollectionViewCell, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
-        let cellToConfigure = cell as! UITagCollectionViewCell
+        guard let cellToConfigure = cell as? UITagCollectionViewCell else {
+            print("Could not load UITagCollectionViewCell..")
+            return UICollectionViewCell()
+        }
         cellToConfigure.fontFamily = self.fontFamily
         cellToConfigure.fontSize = self.fontSize
         cellToConfigure.textColor = self.selectedTags.contains(indexPath.row) ? self.textColorSelected : self.textColor

    }
    
    public func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
        return UIEdgeInsetsMake(0, 0, 0, 0)
    }
    
    //MARK: - collection view delegate implementation

import UIKit
import UICollectionViewLeftAlignedLayout

@IBDesignable 
public class UITags: UIView, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
    
    @IBInspectable var tagColor: UIColor?
    @IBInspectable var tagSelectedColor: UIColor?
    
    @IBInspectable var fontSize: CGFloat = 11.0
    @IBInspectable var fontFamily = "System"
    @IBInspectable var textColor: UIColor?
    @IBInspectable var textColorSelected: UIColor?
    
    @IBInspectable var tagHorizontalDistance: CGFloat = 2
    @IBInspectable var tagVerticalDistance: CGFloat = 3
    
    @IBInspectable var horizontalPadding: CGFloat = 3
    @IBInspectable var verticalPadding: CGFloat = 2
    
    private var collectionView: UICollectionView?

    override public func prepareForInterfaceBuilder() {
        super.prepareForInterfaceBuilder()
        self.tags = ["This", "is","a", "demo","for", "storyboard",".", "Please","make", "an","outlet", "and", "specify", "your", "own", "tags"]
    }
    
    public var delegate: UITagsViewDelegate?
    
    public var tags: [String] = [] {
        didSet {
            self.createTags()
        }
    }
    
    private var selectedTags = [Int]()
    
    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
