             self.selectedTags += [indexPath.row]
             self.delegate?.tagSelected(atIndex: indexPath.row)
         }
-                
+        
         self.configureCell(self.collectionView!.cellForItemAtIndexPath(indexPath)!, cellForItemAtIndexPath: indexPath)
     }
 }

        collectionView?.registerClass(UITagCollectionViewCell.self, forCellWithReuseIdentifier: "tagCell")
        if let collectionView = collectionView {
            self.addSubview(collectionView)
        }
    }
    
    private func createTags() {
        collectionView?.reloadData()
    }
    
    override public func layoutSubviews() {

import UIKit
import UICollectionViewLeftAlignedLayout

@IBDesignable
public class UITags: UIView, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
    
    @IBInspectable public var tagColor: UIColor?
    @IBInspectable public var tagSelectedColor: UIColor?
    
    @IBInspectable public var fontSize: CGFloat = 11.0
    @IBInspectable public var fontFamily = "System"
    @IBInspectable public var textColor: UIColor?
    @IBInspectable public var textColorSelected: UIColor?
    
    @IBInspectable public var tagHorizontalDistance: CGFloat = 2
    @IBInspectable public var tagVerticalDistance: CGFloat = 3
    
    @IBInspectable public var horizontalPadding: CGFloat = 3
    @IBInspectable public var verticalPadding: CGFloat = 2
    
    public 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"]
