+0
日增长
5,825
stars
535
forks
50
watchers
297
prs
376
issues
68
releases
README
FloatingPanel
FloatingPanel is a simple and easy-to-use UI component designed for a user interface featured in Apple Maps, Shortcuts and Stocks app.
The user interface displays related content and utilities alongside the main content.
!Maps
!Stocks
!Maps(Landscape)
Table of Contents
Click here.
- Table of Contents
- Features
- Requirements
- Documentation
- Installation
- Swift Package Manager
- Using Xcode
- Using Package.swift
- CocoaPods
- Getting Started with SwiftUI
- Adding a floating panel within a view
- Presenting a floating panel modally within a view
- Displaying multiple panels
- Next step
- Getting Started with UIKit
- Adding a floating panel as a child view controller
- Presenting a floating panel modally
- Next step
- Maintainer
- License
Features
- Simple container view controller
- Fluid behavior using numeric springing
- Scroll view tracking
- Removal interaction
- Multi panel support
- Modal presentation
- Support for 4 positions (top, left, bottom, right)
- 1 or more magnetic anchors(full, half, tip and more)
- Layout support for all trait environments(i.e. Landscape orientation)
- Common UI elements: surface, backdrop and grabber handle
- Free from common Auto Layout and gesture handling issues
- Compatible with Objective-C
- SwiftUI API support
Examples can be found here:
- Maps like Apple Maps.app.
- Maps-SwiftUI like Apple Maps.app using SwiftUI.
- Stocks like Apple Stocks.app.
- Samples
- SamplesObjC
- SamplesSwiftUI
Requirements
FloatingPanel is written in Swift 5.0+ and compatible with iOS 15.0+.
Documentation
- API reference on Swift Package Index
- FloatingPanel SwiftUI API Guide
- FloatingPanel API Guide
- FloatingPanel 2.0 Migration Guide
Installation
Swift Package Manager
Using Xcode
Just follow this documentation.
Using Package.swift
In your Package.swift Swift Package Manager manifest, add the following dependency to your dependencies argument:
swift
.package(url: "https://github.com/scenee/FloatingPanel", from: "3.2.4"),
Add Numerics as a dependency for your target:
swift
.target(name: "MyTarget", dependencies: [
.product(name: "FloatingPanel", package: "FloatingPanel"),
"AnotherModule"
]),
And then add import FloatingPanel in your source code.
CocoaPods
FloatingPanel is available through CocoaPods. To install
it, simply add the following line to your Podfile:
ruby
pod 'FloatingPanel'
Getting Started with SwiftUI
Adding a floating panel within a view
swift
@State private var layout = MyFloatingPanelLayout()
@State private var state: FloatingPanelState?
var view: some View {
MainView()
.floatingPanel { proxy in
ScrollView {
VStack(spacing: 20) {
ForEach(items) { item in
ItemRow(item)
}
}
.padding()
}
.floatingPanelScrollTracking(proxy: proxy)
}
.floatingPanelState($state)
.floatingTop issues
#281SwiftUI Support/Example?19 comments · 2019-10-26#508Scrollview inside floating panel not scrolling11 comments · 2021-10-22#399 lock the panel and prevent going to tip state?9 comments · 2020-10-22#259iPad Rotation to Landscape - FloatingPanelSurfaceView height constraint not updated9 comments · 2019-09-05#210Not provided any delegate method for tracking scroll offset of panel.9 comments · 2019-05-27#574Floating Panel continues dragging for magic numbers8 comments · 2022-10-15#586Crash due to the use of method swizzling7 comments · 2023-04-11#473crash when modal presenting a floating panel with UINavigationController as contentViewController7 comments · 2021-06-05
Discussions
#656a0 comments · 2025-01-08#654How I can track % of cell is currently visible inside drawer controller2 comments · 2024-12-04#646Prevent scroll view content from being locked1 comments · 2024-09-10#604SwiftUI Support?1 comments · 2023-08-02#596Can I put custom image on grabber handle?0 comments · 2023-06-19#560UI is different when presenting a viewcontroller in a floating panel0 comments · 2022-08-22#558Change the state of the FlowPanel by pressing a button1 comments · 2022-08-17#532Push floating panel above tab bar2 comments · 2022-02-25
Latest release
3.2.4 3.2.4 2026-09-06[!IMPORTANT] A panel no longer shifts with the keyboard in the SwiftUI integration, since the keyboard safe area of the main UIHostingController.view no longer propagates to it. Workarounds such as the ignoresKeyboardSafeArea() helper are no longer needed (it has been removed from the Maps-SwiftUI example). Fixed - Fixed the unsupported view hierarchy warning on iOS 26 in the SwiftUI integration (688). Thank you to @lipopli for this release! The API document: https://swiftpackageindex.com/scenee/FloatingPanel/3.2.4/documentation/floatingpanel Full Changelog: https://github.com/