         layoutIfNeeded()
     }
     
+    
+    /// Registers a nib object containing a cell with the paging menu view under a specified identifier.
+    ///
+    /// - Parameters:
+    ///   - nib: A nib object that specifies the nib file to use to create the cell.
+    ///   - identifier: The reuse identifier for the cell. This parameter must not be nil and must not be an empty string.
     public func register(nib: UINib?, with identifier: String) {
         nibs[identifier] = nib
     }
     
+    
+    /// Returns a reusable paging menu view cell object for the specified reuse identifier and adds it to the menu.
+    ///
+    /// - Parameter identifier: A string identifying the cell object to be reused. This parameter must not be nil.
+    /// - Returns: The index specifying the location of the cell.
     public func dequeue(with identifier: String) -> PagingMenuViewCell {
         if var cells = queue[identifier], !cells.isEmpty {
             let cell = cells.removeFirst()

        }
    }
    
    var numberOfItem: Int = 0
    
    public func indexForItem(at point: CGPoint) -> Int? {
        return frameQueue.enumerated().filter { $1.contains(point) }.flatMap{ $0.offset }.first
    }
    
    
    public func cellForItem(at index: Int) -> PagingMenuViewCell? {
        return visibleCells.filter { $0.index == index }.first
    }
    
    public func reloadData() {
        guard let dataSource = dataSource else {
            return


import UIKit


/**
 A PagingMenuViewCell object presents the content for a single menu item when that item is within the paging menu view's visible bounds. 
 You can use this class as-is or subclass it to add additional properties and methods. The layout and presentation of cells is managed by the paging menu view.
 */
open class PagingMenuViewCell: UIView {
    
    /**
     The selection state of the cell.
     
     It is not managed by this class and paging menu view now.
     */
    open var isSelected: Bool = false
    
    /**
     A string that identifies the purpose of the view.
     
     The paging menu view identifies and queues reusable views using their reuse identifiers. The paging menu view sets this value when it first creates the view, and the value cannot be changed later. When your data source is prompted to provide a given view, it can use the reuse identifier to dequeue a view of the appropriate type.
    */
    public internal(set) var identifier: String!
    
    /**
     A index that identifier where the view locate on.
     
     The paging menu view identifiers and queues reusable views using their reuse identifiers. The index specify current state for the view's position.
     */
    public internal(set) var index: Int!
}


/**
 An object that adopts the PagingMenuViewDataSource protocol is responsible for providing the data and views required by a paging menu view. 
 A data source object represents your app’s data model and vends information to the collection view as needed.
 It also handles the creation and configuration of cells and supplementary views used by the collection view to display your data.
 */
public protocol PagingMenuViewDataSource: class {
    
    /// Asks your data source object for the number of sections in the paging menu view.
    ///
    /// - Returns: The number of items in paging menu view.
    func numberOfItemForPagingMenuView() -> Int
    
    /// Asks your data source object for the cell that corresponds to the specified item in the paging menu view.
    /// You can use this delegate methid like UITableView or UICollectionVew.
    ///
    /// - Parameters:
    ///   - pagingMenuView: The paging menu view requesting this information.
    ///   - index: The index that specifies the location of the item.
    /// - Returns: A configured cell object. You must not return nil from this method.
    func pagingMenuView(pagingMenuView: PagingMenuView, cellForItemAt index: Int) -> PagingMenuViewCell
    
    
    /// Asks the delegate for the width to use for a row in a specified location.
    ///
    /// - Parameters:
    ///   - pagingMenuView: The paging menu view requesting this information.
    ///   - index: The index that specifies the location of the item.
    /// - Returns: A nonnegative floating-point value that specifies the width (in points) that row should be.
    func pagingMenuView(pagingMenuView: PagingMenuView, widthForItemAt index: Int) -> CGFloat
}

/**
 The PagingMenuViewDelegate protocol defines methods that allow you to manage the selection of items in a paging menu view and to perform actions on those items.
 */
public protocol PagingMenuViewDelegate: UIScrollViewDelegate {
    
    /// Tells the delegate that the specified row is now selected.
    ///
    /// - Parameters:
    ///   - pagingMenuView: The paging menu view requesting this information.
    ///   - index: The index that specifies the location of the item.
    func pagingMenuView(pagingMenuView: PagingMenuView, didSelectItemAt index: Int)
}


/// Displays menu lists of information and supports selection and paging of the information.
public class PagingMenuView: UIScrollView {

    /// The paging menu cells that are visible in the table view.
    public fileprivate(set) var visibleCells = [PagingMenuViewCell]()

    fileprivate var queue = [String: [PagingMenuViewCell]]()
