ipagong/PGTabBar-Swift

Dynamic Tabs

Closed this issue · 2 comments

Thanks for this awesome library, however, I would like to ask, how can I create the tabs dynamically.
the number of tabs to be created would be determined by a json response. So basically i want to have one ViewController with a tableView as subview for the number of tabs i want to create, the data for a particular tab for each tableView would be different.

updated to change tab when setup tablist property. (version 0.2.1)

in my project, also needed to change tab dynamically.. but it wouldn't changed..so i fix it.

so in your case,
you should set tabList after received json data.

even if tabList is nil or empty. :)

Add method :

func reloadData(animated:Bool = false, preferredIndex:Bool = false, _ tabListClosure:() -> (Array<TabItemProtocol>?))

because setTabList() function is little bit similar with reloadData.
i thought it would be better to change it.