Introducing the new SwiftUI API in FloatingPanel
- 13 May, 2025

I’m so happy to announce the launch of the new SwiftUI API for FloatingPanel. After more than 3 years since @zntfdr first drafted the initial concept in the Maps-SwiftUI example app, this long-awaited API is finally available in the library. Although the journey took longer than expected, completing this work has made me feel satisfied and relieved. For more details about this API, please see the SwiftUI API guide.
In this blog post, I’d like to share the background of the development and express my gratitude.
Why did it take so long?
Of course, I haven’t been working on this continuously during that time. In 2021, I had my second child, which significantly limited my free time for personal projects. That’s why it was hard to make progress on this work.
Another reason was that I was still forming a mental model of what an ideal SwiftUI API should look like. To be honest, I initially didn’t see a compelling need for it. The UIKit integration using UIViewControllerRepresentable
seemed so well-designed that integrating FloatingPanel into SwiftUI apps appeared straightforward. However, that assumption turned out to be a significant oversight.
Realizing the need for the SwiftUI API
In 2024, I received an email from a user asking how to integrate FloatingPanel into SwiftUI. He was experiencing an issue with the integration. This was when I first realized there was a subtle pitfall when integrating FloatingPanel with SwiftUI, and the solution wasn’t immediately obvious. This became the catalyst for why I felt I needed to provide a proper SwiftUI API for FloatingPanel.
The pitfall was that simply stacking a UIViewControllerRepresentable
-wrapped FloatingPanelController
in a ZStack
with the main view didn’t work. The reason is that the passthrough view in FloatingPanelController
can’t pass touches to its main view. In fact, as implemented in Maps-SwiftUI, you need to wrap a UIHostingController
for the main view and then add the FloatingPanelController
to it. The Maps-SwiftUI example app’s implementation seemed so natural that I hadn’t realized that other seemingly natural approaches wouldn’t work properly. I’m truly grateful to that user whose inquiry finally made me see this issue clearly.
Overcoming Challenges
Once I recognized the importance of a SwiftUI API, I faced another challenge: FloatingPanelController
heavily relies on FloatingPanelControllerDelegate
for customization. While the previous Maps-SwiftUI implementation passed this through floatingPanel(delegate:content:)
, that approach wasn’t a truly SwiftUI-native API. To solve this, I decided to introduce FloatingPanelCoordinator
. For more detail, please read the “FloatingPanelCoordinator
: The key component” section of the SwiftUI API Guide. It took me some time to come up with this API structure.
I also needed to develop the concept of managing FloatingPanelState
, FloatingPanelLayout
, and FloatingPanelBehavior
in SwiftUI. A breakthrough came when I watched Peter Friese’s talk “Why every SwiftUI developer should care about the environment?” at SwiftHeroes 2025.
While I thought I understood the SwiftUI Environment well enough, I hadn’t fully grasped its potential when used with view modifiers. As a result, although the Maps-SwiftUI example app already had an excellent implementation using Environment with view modifiers, I couldn’t recognize its potential. Watching that talk helped me realize that managing these components through Environment was very natural for a SwiftUI API, which led me to implement them as view modifiers.
How does this compare to Apple’s built-in APIs?
Of course, I have concerns about releasing a SwiftUI API this late. Apple already provides Sheet presentation in iOS 15, and in iOS 17 they added the Inspector modifier. I strongly recommend using them if you can achieve your use case with these APIs.
However, I believe there are still some use cases that their built-in APIs don’t cover well. For example, cases where auxiliary views are displayed within TabView or ToolBar. This is because FloatingPanel is designed as a supplemental view that can be integrated into the screen, not as a modal interface. We kept this principle firmly in mind when designing the SwiftUI API. That’s why I developed the new SwiftUI API.
Thank You
I’d like to express my deepest gratitude to everyone involved with FloatingPanel, and especially to @zntfdr who created the foundation for the SwiftUI API.
If you encounter any issues or have feedback, please post them to GitHub Issues or Discussions.
Thank you for reading this article. I hope it helps you build great iOS apps.