Giter Site home page Giter Site logo

tree-view's Introduction

RXTreeControl

CocoaPods CocoaPods codebeat badge Swift 2.2 Twitter Travis

Requirements

  • iOS 8.0+
  • Xcode 7.2

Installation

Just add the RXTreeContol folder to your project.

or use CocoaPods with Podfile:

pod 'RXTreeControl', '~> 0.0.2'

Usage

For using this library you have to install 'RxSwift', 'RxCocoa', 'RxBlocking',

Create reactive observing variable and add to them your custom model view

let itemTrees:Variable  = Variable(treeController.treeArray as [TreeModelView])

You can call this method for reactive filling cell

	     itemTrees
      .bindTo(tableView.rx_itemsWithCellIdentifier("Cell0")) { (row, element, cell) in
            let tcell = cell as! TableViewCell
            tcell.titleLabel?.text = "\(element.treeObject.title ) @ Level \(element.level)"
            let colorRed = CGFloat(200 - element.level*10  ) / CGFloat(255.0)
            let colorGreen = CGFloat(element.level*10 + 20) / CGFloat(255.0)
            let colorBlue = CGFloat(100 - element.level*10 + 20) / CGFloat(255.0)
             
            tcell.backgroundColor =  UIColor(red: colorRed,
                green: colorGreen,
                blue: colorBlue,
                alpha: CGFloat(1.0)
            )
           tcell.setNeedsLayout()
         }
      .addDisposableTo(disposeBag)

This listener change when you select table view cell and put to value your model view

     tableView
    .rx_modelSelected(TreeModelView)
    .subscribeNext {value in
               
    }	
   .addDisposableTo(disposeBag)

This listener change when you open subrow by index

   tableView.rx_itemSubRowOpen.subscribeNext { (sourceIndex: NSIndexPath) -> Void in  
    
   }.addDisposableTo(disposeBag)

This listener change when you close subrow by index

   tableView.rx_itemSubRowClosed
   .subscribeNext { (sourceIndex: NSIndexPath) -> Void in

   }.addDisposableTo(disposeBag)

This listener change when you close subrow by index

   tableView.rx_itemRowMoved
   .subscribeNext { (sourceIndex: NSIndexPath, destinationIndex: NSIndexPath) -> Void in

   }.addDisposableTo(disposeBag)

This listener change when subrow move to root

   tableView.rx_itemSubRowMovedToRoot
   .subscribeNext { (sourceIndex: NSIndexPath, destinationIndex: NSIndexPath) -> Void in

   }.addDisposableTo(disposeBag)

This listener show changing position when row move to subrow

	tableView.rx_itemSubRowMoved
  .subscribeNext { (sourceIndex: NSIndexPath, destinationIndex: NSIndexPath) -> Void in

  }.addDisposableTo(disposeBag)

This listener returned last changed reorder row to subrow

   tableView.rx_itemSubRowMove
  .subscribeNext { (sourceIndex: NSIndexPath, destinationIndex: NSIndexPath) -> Void in
 
  }.addDisposableTo(disposeBag)

This listener show changing position when row move to root

   tableView.rx_itemMoveToRoot
  .subscribeNext { (sourceIndex: NSIndexPath, destinationIndex: NSIndexPath) -> Void in  

  .addDisposableTo(disposeBag)

This listener returned last changed reorder row to root

 tableView.rx_itemMovedToRoot
 .subscribeNext { (sourceIndex: NSIndexPath, destinationIndex: NSIndexPath) -> Void in  
   
 }.addDisposableTo(disposeBag)

This block return custom view which highlight selected cell for reordering

tableView.rx_dataSource.viewBlock =  { (cell:UITableViewCell, destinationIndex: NSIndexPath) -> UIView in
  let view = UIView(frame: CGRectMake(0,cell.frame.height - 2 ,self.tableView.frame.width,2))
 view.backgroundColor = UIColor.blueColor();
 return view           
}

This listener called when cell will viewed

 tableView.rx_viewWillDisplayCell.subscribeNext { (cell: UITableViewCell, destinationIndex: NSIndexPath) -> Void in
 
 }.addDisposableTo(disposeBag)

Snapshots

Solution Solution Solution

Licence

Adaptive tab bar is released under the MIT license. See LICENSE for details.

About

The project maintained by app development agency Ramotion Inc. See our other open-source projects or hire us to design, develop, and grow your product.

Twitter URL Twitter Follow

tree-view's People

Contributors

artemkyslicyn avatar skogetroll avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.