         }
     }
 
+    /**
+        It is called when value changes
+     */
     public var valueDidChange: ((String?) -> ())?
 
     private var segmentedControls: [UISegmentedControl] = [UISegmentedControl]()


    private var _value: String?

    public var value: String? {
        get {
            return self._value

import UIKit
import SnapKit

/**
 A multiline segmented control
 */

public class SegmentedControl: UIView {

    /**
        The items of the segmented control
    */
    public var items: [AnyObject] = [AnyObject]() {
        didSet {
            createSegmentedControls()
        }
    }

    /**
        Items per row
     */
    public var itemsPerRow = 3 {
        didSet {
            createSegmentedControls()
        }
    }
    
    /**
        Spacing between the rows
     */
    public var spacing: Double = 0 {
        didSet {
            createSegmentedControls()
