Skip to content

v1.7.0: Add new and enhanced APIs

Compare
Choose a tag to compare
@scenee scenee released this 05 Oct 04:53

This release includes the new APIs to enhance the use cases. ✨ 🎉 ✨

And now FloatingPanel.podspec uses swift_versions! So CocoaPods v1.7.0 or later is required for the installation.

I would like to continue to enhance this UI component with you. Welcome to your report and PR.

New APIs

FloatingPanelController

var contentMode: FloatingPanelController.ContentMode
changes.
    public enum ContentMode: Int {
        case `static`
        case fitToBounds
    }

This allows to change the surface height as following a user interaction and fix the bottom of a panel. For example, you can display a fixed footer view upon Auto Layout constraints.

See also Show Detail Panel sample in Samples.app.

✏️ In .fitToBounds mode, you have a responsibility to configure Auto Layout constrains not to break the layout of a content view by the elastic surface height.

FloatingPanelSurfaceView

var containerMargins: UIEdgeInsets

This allows to modify the surface container margins. For example, the following use cases.

  • Facebook/Slack-like panel whose surface top edge is separated from the grabber handle.
  • iOS native panel to display AirPods information.

See also showContainerMargins sample in Samples.app.

FloatingPanelBackdropView

var dismissalTapGestureRecognizer: UITapGestureRecognizer!

This allows to disable tap on backdrop view for panel dismissal. by @nderkach

FloatingPanelLayout

var positionReference: FloatingPanelLayoutReference
public enum FloatingPanelLayoutReference: Int {
    case fromSafeArea = 0
    case fromSuperview = 1
}

This allows to change the referred bounds used to calculate each position from FloatingPanelLayout.insetFor(_:)

Improvements

  • Add fitToBounds content mode
  • Add support for CocoaPods version 1.7 swift_version by @joshuafinch
  • Add 2 samples, showPageContentView and showContainerMargins in Samples.app
  • Add test cases for new features

Bufixes

  • Call floatingPanelDidEndRemove when dismiss with tap on backdrop view by @rikusouda

Thank you to @joshuafinch @nderkach and @rikusouda for this release!