diff --git a/Examples/Maps-SwiftUI/Maps/FloatingPanel/FloatingPanelView.swift b/Examples/Maps-SwiftUI/Maps/FloatingPanel/FloatingPanelView.swift index a99a2d28..81c24ead 100644 --- a/Examples/Maps-SwiftUI/Maps/FloatingPanel/FloatingPanelView.swift +++ b/Examples/Maps-SwiftUI/Maps/FloatingPanel/FloatingPanelView.swift @@ -96,8 +96,20 @@ struct FloatingPanelView: UIViewContr ignoresKeyboard: true ) hostingViewController.view.backgroundColor = nil - fpc.set(contentViewController: hostingViewController) + let contentViewController = UIViewController() + contentViewController.view.addSubview(hostingViewController.view) + fpc.set(contentViewController: contentViewController) fpc.addPanel(toParent: parentViewController, at: 1, animated: false) + + hostingViewController.view.translatesAutoresizingMaskIntoConstraints = false + let bottomConstraint = hostingViewController.view.bottomAnchor.constraint(equalTo: contentViewController.view.bottomAnchor) + bottomConstraint.priority = .defaultHigh + NSLayoutConstraint.activate([ + hostingViewController.view.topAnchor.constraint(equalTo: contentViewController.view.topAnchor), + hostingViewController.view.leadingAnchor.constraint(equalTo: contentViewController.view.leadingAnchor), + hostingViewController.view.trailingAnchor.constraint(equalTo: contentViewController.view.trailingAnchor), + bottomConstraint + ]) } func updateIfNeeded() {