Skip to content

Repository files navigation

DropDownController

Simple view with custom content and animation like drop-down list

Example:

How usage:

  1. Create instanse of controller on drop-down content and adapter
finalclassExampleDropListViewController:UIViewController{privateletfilterView=FilterView()privateletdropDownTableAdapter=DropDownTableAdapter()private lazy vardropDownController=DropDownController(adapter: dropDownTableAdapter)
  1. Create content adapter(for UITableView in example)
 // Content can be anything, create your content adapter and sign with DropDownAdapterProtocol
privatefunc getAdapter(for table:UITableView)->AnyObject{
table.backgroundColor =.black
table.layer.cornerRadius =12
table.separatorStyle =.none
// Table adapter can be AnyObject, simple class or self
letadapter=BaseTableAdapter(tableView: table)letmodel=BasicCell.Model(title:"Test example with text", backgroundColor:.gray)letcellController=CellController<BasicCell>(model: model)
adapter.append(cellController: cellController)
adapter.append(cellController: cellController)
adapter.append(cellController: cellController)return adapter
}
  1. Inject adapter with custom content
filterView.onDidTouchTriggered{ isOpen inif isOpen {self.dropDownTableAdapter.injectContentAdapter(self.getAdapter(for:))self.dropDownController.showDropDownList(below:self.filterView, offset:8)}else{self.dropDownController.hideDropDonwList()}}

About

Simple drop down container for create drop down lists

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages