 import SwiftyFORM
 
 class FlowLayout: UICollectionViewFlowLayout {
-	
+	override func layoutAttributesForSupplementaryViewOfKind(elementKind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {
+		return nil
+	}
+	
+	override func prepareLayout() {
+		super.prepareLayout()
+		
+		scrollDirection = .Horizontal
+		minimumInteritemSpacing = 1
+		minimumLineSpacing = 1
+		sectionInset = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5)
+		headerReferenceSize = CGSizeZero
+		footerReferenceSize = CGSizeZero
+	}
 }
 
 class SliderCell: UICollectionViewCell {
 	static let identifier = "cell"
+	
+	override init(frame: CGRect) {
+		super.init(frame: frame)
+		commonInit()
+	}
+	
+	required init?(coder aDecoder: NSCoder) {
+		super.init(coder: aDecoder)
+		commonInit()
+	}
+	
+	func commonInit() {
+		addSubview(tl)
+		addSubview(tr)
+		addSubview(bl)
+		addSubview(br)
+	}
+	
+	lazy var tl: UIView = {
+		let instance = UIView()
+		instance.backgroundColor = UIColor.redColor()
+		return instance
+	}()
+	
+	lazy var tr: UIView = {
+		let instance = UIView()
+		instance.backgroundColor = UIColor.blueColor()
+		return instance
+	}()
+	
+	lazy var bl: UIView = {
+		let instance = UIView()
+		instance.backgroundColor = UIColor.greenColor()
+		return instance
+	}()
+	
+	lazy var br: UIView = {
+		let instance = UIView()
+		instance.backgroundColor = UIColor.whiteColor()
+		return instance
+	}()
+	
+	override func layoutSubviews() {
+		super.layoutSubviews()
+		tl.frame = CGRect(x: 0, y: 0, width: 10, height: 10)
+		tr.frame = CGRect(x: bounds.maxX - 10, y: 0, width: 10, height: 10)
+		bl.frame = CGRect(x: 0, y: bounds.maxY - 10, width: 10, height: 10)
+		br.frame = CGRect(x: bounds.maxX - 10, y: bounds.maxY - 10, width: 10, height: 10)
+	}
 }
 
 

		}
	}
	
	override func viewWillLayoutSubviews() {
		super.viewWillLayoutSubviews()
		var frame = view.bounds
		frame.size.height = 100
		frame.origin.y = (view.bounds.height - frame.height) * 0.5
		collectionView.frame = frame
	}
	
	override func viewWillAppear(animated: Bool) {
		super.viewWillAppear(animated)
		view.addGestureRecognizer(pinchGestureRecognizer)
	}

	override func viewDidDisappear(animated: Bool) {

	}()
	
	func computeItemSize() -> CGSize {
		let w = round(50 * scale)
//		return CGSize(width: w, height: collectionView.bounds.height)
//		return CGSize(width: w, height: collectionViewHeight)
		return CGSize(width: w, height: 40)
//		return CGSize(width: w, height: 150)
	}
	
	func createFlowLayout() -> FlowLayout {
		let instance = FlowLayout()
//		instance.scrollDirection = .Horizontal
//		instance.minimumInteritemSpacing = 1
//		instance.minimumLineSpacing = 1
//		instance.sectionInset = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5)
//		instance.headerReferenceSize = CGSizeZero
//		instance.footerReferenceSize = CGSizeZero
//		instance.itemSize = computeItemSize()
		return instance
	}
