Я пытаюсь сделать материал приложения с помощью MDC от Google.Принимая во внимание, что я могу получить панель вкладок материала, я не могу изменить вкладки, проводя.Я знаю, что это можно сделать, добавив распознаватели жестов смахивания к каждому контроллеру представления и в зависимости от направления, в котором я могу манипулировать выбранным индексом MDCTabBar, но есть ли какая-либо встроенная поддержка MDCTabBar?В SO ответе пользователь сказал, что в репозитории github есть пример, но я не могу его найти.Как я могу это сделать?
Мой код до сих пор
let tabBar = MDCTabBar(frame: view.bounds)
tabBar.items = [
UITabBarItem(title: "Rules", image: nil, tag: 0),
UITabBarItem(title: "Live", image: nil, tag: 1),
UITabBarItem(title: "Scenes", image: nil, tag: 2),
UITabBarItem(title: "Things", image: nil, tag: 3)
]
tabBar.itemAppearance = .titles
tabBar.autoresizingMask = [.flexibleWidth, .flexibleBottomMargin]
tabBar.alignment = .center
tabBar.sizeToFit()
tabBar.backgroundColor = UIColor(netHex: "1B59A8")
tabBar.translatesAutoresizingMaskIntoConstraints=false
view.addSubview(tabBar)
let upperConstraint = NSLayoutConstraint(item: tabBar, attribute: NSLayoutAttribute.top, relatedBy: NSLayoutRelation.equal, toItem: appBar.view, attribute: NSLayoutAttribute.bottom, multiplier: 1, constant: 0)
let leftConstraint = NSLayoutConstraint(item: tabBar, attribute: NSLayoutAttribute.left, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.left, multiplier: 1, constant: 0)
let rightConstraint = NSLayoutConstraint(item: tabBar, attribute: NSLayoutAttribute.right, relatedBy: NSLayoutRelation.equal, toItem: self.view, attribute: NSLayoutAttribute.right, multiplier: 1, constant: -0)
let heightConstraint = NSLayoutConstraint(item: tabBar, attribute: NSLayoutAttribute.height, relatedBy: NSLayoutRelation.equal, toItem: nil, attribute: NSLayoutAttribute.notAnAttribute, multiplier: 1, constant: 50)
NSLayoutConstraint.activate([upperConstraint,leftConstraint,rightConstraint,heightConstraint])
appBar.didMove(toParentViewController: self)