TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Victor Sigler.
AccordionMenu is an accordion/dropdown library written in Swift.
After import the framework it’s neccessary to inherit from the class AccordionTableViewController
and set it’s data source the total of items from the data source and if you like if several cells is expanded or only one like in the following example:
import UIKit
import AccordionMenuSwift
class AccordionViewController: AccordionTableViewController {
override func viewDidLoad() {
super.viewDidLoad()
let item1 = Parent(state: .collapsed, childs: ["SubItem 1", "SubItem 2", "SubItem 3"], title: "Item 1")
let item2 = Parent(state: .collapsed, childs: ["SubItem 1", "SubItem 2"], title: "Item 2")
let item3 = Parent(state: .collapsed, childs: ["SubItem 1", "SubItem 2", "SubItem 3"], title: "Item 3")
let item4 = Parent(state: .collapsed, childs: ["SubItem 1", "SubItem 2"], title: "Item 4")
let item5 = Parent(state: .collapsed, childs: ["SubItem 1", "SubItem 2"], title: "Item 5")
self.dataSource = [item1, item2, item3, item4, item5]
self.numberOfCellsExpanded = .several
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Afterwards it’s necessary to define two cells in the UITableView
with the identifiers "ParentCell"
and "ChildCell"
and set its Style
to Basic to add two UILabels
for the cells.
You can see the Example project for more information in how to integrate it.
Please raise a GitHub issue.
Great! Please launch a pull request.
The MIT License. See the LICENSE file for more infomation.