iOS 17 에서 제대로 표시가 되지 않는 이슈를 수정하기 위해 레포 fork 와 별도 유지보수를 시작했습니다.
현재 PanModal 은 마지막 배포가 20년으로, 올라온 PR 들에 대해 관리를 하고 있지 않은 상황입니다.
저희가 따로 필요한 유지보수를 하거나 장기적으론 이 라이브러리 자체에 대한 대응을 고민해야 하는 상태입니다.
PanModal is an elegant and highly customizable presentation API for constructing bottom sheet modals on iOS.
Features • Compatibility • Installation • Usage • Documentation • Contributing • Authors • License
Read our blog on how Slack is getting more 👍 with PanModal
Swift 4.2 support can be found on the Swift4.2
branch.
- Supports any type of
UIViewController
- Seamless transition between modal and content
- Maintains 60 fps performance
PanModal requires iOS 10+ and is compatible with Swift 4.2 projects.
pod 'PanModal'
github "slackhq/PanModal"
dependencies: [
.package(url: "https://github.com/slackhq/PanModal.git", .exact("1.2.6")),
],
PanModal was designed to be used effortlessly. Simply call presentPanModal
in the same way you would expect to present a UIViewController
.presentPanModal(yourViewController)
The presented view controller must conform to PanModalPresentable
to take advantage of the customizable options
extension YourViewController: PanModalPresentable {
var panScrollable: UIScrollView? {
return nil
}
}
If the presented view controller has an embedded UIScrollView
e.g. as is the case with UITableViewController
, panModal will seamlessly transition pan gestures between the modal and the scroll view
class TableViewController: UITableViewController, PanModalPresentable {
var panScrollable: UIScrollView? {
return tableView
}
}
Height values of the panModal can be adjusted by overriding shortFormHeight
or longFormHeight
var shortFormHeight: PanModalHeight {
return .contentHeight(300)
}
var longFormHeight: PanModalHeight {
return .maxHeightWithTopInset(40)
}
Values are stored during presentation, so when adjusting at runtime you should call panModalSetNeedsLayoutUpdate()
func viewDidLoad() {
hasLoaded = true
panModalSetNeedsLayoutUpdate()
panModalTransition(to: .shortForm)
}
var shortFormHeight: PanModalHeight {
if hasLoaded {
return .contentHeight(200)
}
return .maxHeight
}
Check out the Sample App for more complex configurations of PanModalPresentable
, including navigation controllers and stacked modals.
Option + click on any of PanModal's methods or notes for detailed documentation.
We're glad to be open sourcing this library. We use it in numerous places within the slack app and expect it to be easy to use as well as modify; we've added extensive documentation within the code to support that.
We will only be fixing critical bugs, thus, for any non-critical issues or feature requests we hope to be able to rely on the community using the library to add what they need. For more information, please read the contributing guidelines.
Stephen Sowole • Tosin Afolabi
PanModal is released under a MIT License. See LICENSE file for details.