uias / Tabman

™️ A powerful paging view controller with interactive indicator bars
https://uias.github.io/Tabman
MIT License
2.84k stars 235 forks source link

Loading large numbers of tab (around 50) #594

Open maasim94 opened 2 years ago

maasim94 commented 2 years ago

I have searched in existing issues but could not find any solution.

I have situations where i need to create multiple webview which i'm handling through tabman. problem is it is taking too much time to load and app kind of stuck for some seconds.

Implementation is really straightforward and according to docs.

class TabViewController: TabmanViewController {
         override func viewDidLoad() {
        super.viewDidLoad()

        self.dataSource = self

        let bar = TMBarView<TMConstrainedHorizontalBarLayout, TMTabItemBarButton, TMLineBarIndicator>()
        bar.buttons.customize {

            $0.tintColor = Asset.lightBlue.color
            $0.selectedTintColor = Asset.darkSkyBlue.color
            $0.font = FontFamily.MyriadPro.bold.font(size: 14)
            $0.adjustsFontForContentSizeCategory = true

        }

        bar.spacing = 16
        bar.fadesContentEdges = false
        bar.layout.transitionStyle = .snap // Customize 
        let systembar = bar.systemBar()
        systembar.backgroundStyle = .flat(color: UIColor.white)

        self.addBar(systembar,
                    dataSource: self,
                    at: .top)
        self.loadSelectedWebsites()
    }

    func loadData() {
       for selectedWebsite in self.selectedWebsites {
            let webController = StoryboardScene.Main.webViewController.instantiate()
            webController.delegate = self
            webController.websiteURL = selectedWebsite.url
            self.viewControllers.append(webController)
        }
        self.reloadData()
    }
}

and class conforms to datasource delegates of Tabman