### Custom Tab Bar Controller Implementation Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Example of a custom tab bar controller subclass that overrides properties to integrate with LNPopupController. It defines the custom tab bar as the docking view and handles its visibility and frame. ```swift class MyCustomTabBarController: UITabBarController { override var bottomDockingViewForPopupBar: UIView? { return myCustomTabBar } override var defaultFrameForBottomDockingView: CGRect { myCustomTabBar.frame } override var isBottomDockingViewForPopupBarHidden: Bool { !isMyCustomTabBarVisible } override var bottomDockingViewMarginForPopupBar: CGFloat { 8.0 } func toggleMyCustomTabBarVisible() { UIView.animate(withDuration: 0.4, delay: 0.0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0.0) { self.isMyCustomTabBarVisible.toggle() // Animate your bar position here according to isMyCustomTabBarVisible. self.updateMyCustomTabBarConstraints() // Trigger a layout pass so that the popup bar animates to the correct position self.view.layoutIfNeeded() } } } ``` -------------------------------- ### Set Popup Bar Progress View Style Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Customize the popup bar's progress view style by setting the `progressViewStyle` property. The default is hidden. Example shows setting it to `.top`. ```swift navigationController?.popupBar.progressViewStyle = .top ``` -------------------------------- ### Set Popup Close Button Style Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Customize the popup close button style by setting the popup content view's `popupCloseButtonStyle` property. Example shows setting it to `.prominentGlass`. ```swift navigationController.popupContentView.popupCloseButtonStyle = .prominentGlass ``` -------------------------------- ### Enable Popup Bar Minimization Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Enable popup bar minimization by setting the `tabBarMinimizeBehavior` property on the `UITabBarController`. This feature is supported starting with iOS 26. ```swift self.tabBarController?.tabBarMinimizeBehavior = .onScrollDown ``` -------------------------------- ### Set Popup Bar Style to Floating Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Customize the popup bar's appearance by setting its barStyle property. The .floating style is available starting from iOS 26. ```swift navigationController?.popupBar.barStyle = .floating ``` -------------------------------- ### Presenting Popup Bar with Content Controller as Data Source Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Demonstrates how to create a content view controller, set its popup item properties, and present the popup bar using the default mode where the content controller acts as the data source. ```swift class PopupContentViewController: UIViewController { init() { // ... popupItem.title = "Hello Title" popupItem.subtitle = "And a Subtitle!" popupItem.progress = 0.34 popupItem.barButtonItems = [/* ... */] } } func presentPopupBar() { let contentVC = PopupContentViewController() tabBarController?.presentPopupBar(with: contentVC) } ``` -------------------------------- ### Presenting Popup Bar with Developer-Provided Data Source Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Illustrates how to configure the popup bar to use a developer-provided data source by setting `usesContentControllersAsDataSource` to false. It also shows how to set an initial popup item and present the content controller. ```swift class PopupContainerController: UIViewController { // ... func presentPopupBar() { tabBarController?.popupBar.usesContentControllersAsDataSource = false let initialPopupItem = LNPopupItem() initialPopupItem.title = "Hello Title" initialPopupItem.subtitle = "And a Subtitle!" initialPopupItem.progress = 0.34 initialPopupItem.barButtonItems = [/* ... */] tabBarController?.popupBar.popupItem = initialPopupItem let contentVC = PopupContentViewController() tabBarController?.presentPopupBar(with: contentVC) } } ``` -------------------------------- ### Present Popup Bar and Open Popup Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md This method allows presenting the popup bar with specified content and opening the popup in a single animation. ```swift tabBarController?.presentPopupBar(with: contentVC, openPopup:true) ``` -------------------------------- ### Implement Popup Item Paging Data Source Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Implement these methods in your data source to enable paging between popup items. Return the previous or next popup item, or nil if none exists. ```swift func popupBar(_ popupBar: LNPopupBar, popupItemBefore popupItem: LNPopupItem) -> LNPopupItem? { // Return a popop item representing the content before `popupItem` or `nil` } func popupBar(_ popupBar: LNPopupBar, popupItemAfter popupItem: LNPopupItem) -> LNPopupItem? { // Return a popop item representing the content after `popupItem` or `nil` } ``` -------------------------------- ### Listen to Bar Environment Changes Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Register for `LNPopupBar.EnvironmentTrait` changes to update the popup item accordingly. This allows for dynamic adjustments based on the bar's environment, such as inline display. ```swift registerForTraitChanges([LNPopupBar.EnvironmentTrait.self]) { (self: Self, previousTraitCollection) in self.popupItem.barButtonItems?.last?.isHidden = self.traitCollection.popupBarEnvironment == .inline } ``` -------------------------------- ### Import LNPopupController module Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Import the LNPopupController module into your Swift source files to use its functionalities. This line is necessary for accessing the framework's classes and methods. ```swift import LNPopupController ``` -------------------------------- ### Add LNPopupController as a Swift Package Manager dependency Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Add the LNPopupController package to your Package.swift file. This specifies the repository URL and the version range. ```swift .package(url: "https://github.com/LeoNatan/LNPopupController.git", from: "4.0.0") ``` -------------------------------- ### Open Popup Programmatically Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Use this method to open the popup bar programmatically. An optional completion handler can be provided. ```swift tabBarController?.openPopup() ``` -------------------------------- ### Declare LNPopupController as a target dependency Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Specify LNPopupController as a dependency for your application's target in Package.swift. This makes the framework's components available to your app. ```swift .target(name: "MyExampleApp", dependencies: ["LNPopupController"]) ``` -------------------------------- ### Customize LNPopupBar Appearance Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Define the standard appearance of the popup bar using LNPopupBarAppearance. Set text attributes, shadows, and background effects. Remember to set `inheritsAppearanceFromDockingView` to false to prevent overrides. ```swift let appearance = LNPopupBarAppearance() appearance.titleTextAttributes = AttributeContainer() .font(UIFontMetrics(forTextStyle: .headline).scaledFont(for: UIFont(name: "Chalkduster", size: 14)!)) .foregroundColor(UIColor.yellow) appearance.subtitleTextAttributes = AttributeContainer() .font(UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: UIFont(name: "Chalkduster", size: 12)!)) .foregroundColor(UIColor.green) let floatingBarBackgroundShadow = NSShadow() floatingBarBackgroundShadow.shadowColor = UIColor.red floatingBarBackgroundShadow.shadowOffset = .zero floatingBarBackgroundShadow.shadowBlurRadius = 8.0 appearance.floatingBarBackgroundShadow = floatingBarBackgroundShadow let imageShadow = NSShadow() imageShadow.shadowColor = UIColor.yellow imageShadow.shadowOffset = .zero imageShadow.shadowBlurRadius = 3.0 appearance.imageShadow = imageShadow appearance.floatingBackgroundEffect = UIBlurEffect(style: .dark) navigationController?.popupBar.standardAppearance = appearance navigationController?.popupBar.tintColor = .yellow ``` -------------------------------- ### Handle Popup Item Display Notifications Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Implement this delegate method to be notified when a new popup item is displayed. This is in addition to the content controller's notification. ```swift func popupBar(_ popupBar: LNPopupBar, didDisplay newPopupItem: LNPopupItem, previous previousPopupItem: LNPopupItem?) { // Called when the popup bar's popup item changes (in addition to the content controller's `UIViewController.popupItemDidChange(_:)` call) } ``` -------------------------------- ### Implement Custom Pointer Interactions Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md For custom popup bar controllers, implement the `UIPointerInteractionDelegate` protocol methods within your subclass to define custom pointer interactions. A default implementation is provided for system bar styles. ```swift class CustomPopupBarViewController: LNPopupCustomBarViewController, UIPointerInteractionDelegate { // Implement UIPointerInteractionDelegate methods here } ``` -------------------------------- ### Customize Popup Bar Accessibility Label and Hint Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Set custom accessibility labels and hints for the popup bar by modifying the LNPopupItem properties. This is useful for providing more context to screen reader users. ```swift demoVC.popupItem.accessibilityLabel = NSLocalizedString("Custom popup bar accessibility label", comment: "") demoVC.popupItem.accessibilityHint = NSLocalizedString("Custom popup bar accessibility hint", comment: "") ``` -------------------------------- ### Customize Button Accessibility Labels and Hints Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Add accessibility labels and hints to UIBarButtonItems to improve accessibility for interactive elements within the popup bar. Ensure users understand the button's action. ```swift let upNext = UIBarButtonItem(image: UIImage(named: "next"), style: .plain, target: self, action: #selector(nextItem)) upNext.accessibilityLabel = NSLocalizedString("Up Next", comment: "") upNext.accessibilityHint = NSLocalizedString("Double tap to show up next list", comment: "") ``` -------------------------------- ### Handling Popup Item Changes in Content Controller Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md This method is called on the content controller when the popup item associated with it changes. It's used to update the content view hierarchy or the controller's own popup item. ```swift class PopupContentViewController: UIViewController { // ... override func popupItemDidChange(_ previousPopupItem: LNPopupItem?) { // Handle updating the content view hierarchy with the new popup item // or update self.popupItem as needed. } } ``` -------------------------------- ### Dismiss Popup Bar Programmatically Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Use this method to dismiss the popup bar. If the popup is open, it will also be closed. An optional completion handler can be provided. ```swift tabBarController?.dismissPopupBar() ``` -------------------------------- ### Customize Popup Bar Progress View Accessibility Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Set custom accessibility labels and values for the popup bar's progress view. This provides users with information about the current progress and total duration. ```swift demoVC.popupItem.accessibilityImageLabel = NSLocalizedString("Custom image label", comment: "") demoVC.popupItem.accessibilityProgressLabel = NSLocalizedString("Custom accessibility progress label", comment: "") demoVC.popupItem.accessibilityProgressValue = "\(accessibilityDateComponentsFormatter.stringFromTimeInterval(NSTimeInterval(popupItem.progress) * totalTime)!) \(NSLocalizedString("of", comment: "")) \(accessibilityDateComponentsFormatter.stringFromTimeInterval(totalTime)!) " ``` -------------------------------- ### Set Popup Interaction Style to Drag Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Customize the popup interaction style by setting the popup presentation containing controller's `popupInteractionStyle` property. Use `.drag` for drag-based interaction. ```swift navigationController?.popupInteractionStyle = .drag ``` -------------------------------- ### Disable Popup Bar Minimization Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md To disable popup bar minimization, set the `LNPopupBar.supportsMinimization` property to `false`. This applies to system and custom popup bars, with an exception for custom bars with `LNPopupBar.customBarWantsFullBarWidth = true`. ```swift LNPopupBar.supportsMinimization = false ``` -------------------------------- ### Customize Popup Close Button Accessibility Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md Modify the accessibility label and hint for the popup close button. This allows for clearer instructions for users interacting with the close functionality. ```swift tabBarController?.popupContentView.popupCloseButton.accessibilityLabel = NSLocalizedString("Custom popup close button accessibility label", comment: "") tabBarController?.popupContentView.popupCloseButton.accessibilityHint = NSLocalizedString("Custom popup close button accessibility hint", comment: "") ``` -------------------------------- ### Control Bar Transitions Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md The `hidesBottomBarWhenPushed` property controls popup bar transitions for navigation and tab bar controllers. It ensures the popup bar moves to the bottom of the pushed controller's view when set to true. ```swift navigationController?.hidesBottomBarWhenPushed = true ``` -------------------------------- ### Hide Popup Close Button Source: https://github.com/leonatan/lnpopupcontroller/blob/master/README.md To hide the popup close button, set the `popupCloseButtonStyle` property to `LNPopupCloseButton.Style.none`. ```swift navigationController.popupContentView.popupCloseButtonStyle = LNPopupCloseButton.Style.none ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.