-
I am using LNPopupContentHostingController to present the Player View, I am adding a LNPopupCustomBarHostingController for bar view as well. My question is how can I update the Bar progress and other properties from presented controller? Can I use same object for both Presenting Player and the Bar View ? let viewController = RoutinePlayerController(routine: routine)
self.tabBarController?.presentPopupBar(with: viewController, openPopup: true, animated: true)
self.tabBarController?.popupBar.customBarViewController = LNPopupCustomBarHostingController {
BarView()
}
How can I access bar view from Tabbar controller? There isn't anything about accessing the bar object in example |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Since you are working with https://github.com/LeoNatan/LNPopupController You are mixing UIKit and SwiftUI. You can always cast For example, something like: self.tabBarController?.popupBar.customBarViewController = LNPopupCustomBarHostingController {
BarView()
.environmentObject(myState)
} Then, when you update the If you are unfamiliar with this and confused, you should probably stick to once development environment, either SwiftUI or UIKit.. |
Beta Was this translation helpful? Give feedback.
-
Thank you @LeoNatan Really appreciate that, Thanks for your reply. |
Beta Was this translation helpful? Give feedback.
Since you are working with
UIViewController
s, you need to look at the documentation for LNPopupController:https://github.com/LeoNatan/LNPopupController
https://github.com/LeoNatan/LNPopupController/blob/master/LNPopupController/LNPopupController/UIViewController%2BLNPopupSupport.h
You are mixing UIKit and SwiftUI. You can always cast
self.tabBarController?.popupBar
toLNPopupCustomBarHostingController
, but notice it is a generic class, so figuring out the exact cast is difficult. And what would that help you? Instead, use SwiftUI concepts such asEnvironmentObject
to share state between UIKit and SwiftUI.For example, something like: