I'm making a new framework, Dropdowns
Dropdowns provides the quickest way to present a dropdown in your app. It is very lightweight, just provide a list of items and the action closure you want to handle.
Dropdowns works by showing a child UIViewController
as a dropdown from a TitleView. The most common use case is to show from a UINavigationController, in that sense, you can just create a list of items, and provide to TitleView.
let items = ["World", "Sports", "Culture", "Business", "Travel"]
let titleView = TitleView(navigationController: navigationController!, title: "Menu", items: items)
titleView?.action = { [weak self] index in
print("select \(index)")
}
navigationItem.titleView = titleView
For customizations, Dropdowns uses TableController
by default, to show list of items in a UITableView
. We can customise to show anything you want by using contentController.
let contentController = TableController(items: items, initialIndex: 0)
let dropdown = DropdownController(contentController: contentController, navigationController: navigationController)
Top comments (0)