daviwiki / medium-animatedtabbar

A UIKit TabBar component
GNU General Public License v3.0
9 stars 3 forks source link

Presenting UIViewControllers #1

Closed AbdelrahmanShehab closed 1 month ago

AbdelrahmanShehab commented 1 month ago

how to present UIViewControllers for select, didSelect and willSelect functions?

daviwiki commented 1 month ago

Hello @AbdelrahmanShehab !

You haven't any limitations of how you could present your own view corrntrollers. This TabBar display the bottom bar ui but not store or manage your UIView or UIViewController where it will be displayed, this is your own responsability.

In this way, you have a lot of options, one of them could be listen the didSelect method and present a view Controller when it its fire:

tabBar.didSelectTab.sink { event in
    switdch event {
       case let .didSelect(index):
          self.view.background = self.colors[index]
          self.presenter(MyViewController(), animated: true) // <<< Present a new view controller over current one
      case let .willSelect(index):
          UIView.animate(withDuration: 0.3) {
              self.view.backgroundColor = self.colors[index]
          }
    }
}
.store(in: &cancellables)
shobhajnilu commented 1 month ago

How to make visible TabBar in all the controllers like UITabbarController works?

daviwiki commented 1 month ago

As I comment, this animated tabbar it's a uiview only so you could implement the behaviour you want in the way on your own.

For example you could build your own UIViewController with this tabbar in it, and mount the childs view controllers that you want to present as a childs views of it (using addChild and addSubview methods).

daviwiki commented 1 month ago

I close this issue due to are doubts about how to integrate and deploy view controllers and not by the component itself :).