scenee / FloatingPanel

A clean and easy-to-use floating panel UI component for iOS
MIT License
5.59k stars 508 forks source link

FloatingPanel is not able to be interacted with when added to a UIHostingController in Xcode 16 beta with iOS 18 beta. #640

Open tcombs opened 2 months ago

tcombs commented 2 months ago

Description

When using the latest developer tools of Xcode 16 beta 4 and iOS 18, when a FloatingPanelController is added to a UIHostingController as its parent, the floating panel cannot be interacted with using touch events. All touch events pass through the floating panel to the view behind it.

Expected behavior

I should be able to add a FloatingPanelController to a UIHostingController and interact with the floating panel as normal.

Steps to reproduce

I have reproduced this in a project here

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }

    @IBAction func navigate(_ sender: Any) {
        let view = HostingControllerExampleView() //Any SwiftUI View
        let hostingViewController = MyUIHostingController(rootView: view)
        self.navigationController?.pushViewController(hostingViewController, animated: true)
    }
}
class MyUIHostingController<Content>: UIHostingController<Content> where Content: View {

    var fpc: FloatingPanelController!

    override func viewDidLoad() {
        super.viewDidLoad()

        //Add panel to view
        fpc = FloatingPanelController()

        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let drawerViewController = storyboard.instantiateViewController(withIdentifier: "Drawer")

        fpc.set(contentViewController: drawerViewController)
        fpc.addPanel(toParent: self)
    }
}

Environment

Library version 2.8.4

Installation method

iOS version(s) iOS 18 developer beta 4

Xcode version Xcode 16 beta 4