Swiftpack.co - muukii/Rideau as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
muukii/Rideau
πŸŽͺ Rideau is a drawer UI similar to what Apple's apps use. (e.g Maps, Shortcuts) Supports multiple snap points
.package(url: "https://github.com/muukii/Rideau.git", from: "2.0.0")

πŸŽͺ Rideau

Rideau is a drawer UI similar to what Apple's apps use. (e.g Maps, Shortcuts)

πŸš€ Rideau is in release candidate!

Overview

  • πŸ’Ž Supports multiple snap points (e.g. most hidden, half visible, full visible, and we can add more snap points.)
  • πŸ’Ž Supports Animations alongside moving (e.g. dimming background color)
  • πŸ’Ž Supports handling scrolling of scrollview inside RideauView
  • πŸ’Ž Supports resizing based on intrinsic content size of view that RideauView has
  • βœ… Interactive Animations come from UIViewPropertyAnimator, with this it's actual interruptible animation and no glitches. (it can't get from UIView.animate)

RideauView allows for flexible snap points. Snap points pertains to specified offsets where the draggable view "snaps to" when the dragging has ended. There are usually 2 or 3 snap points.


Objects we will commonly use:

  • RideauView
  • RideauViewController
  • RideauSnapPoint

RideauView is the core object in this library. We typically add our own view to RideauView.

RideauViewController contains a RideauView. It allows us to present the RideauView as modal dialog.

RideauSnapPoint defines where the content view stops.

πŸ”Ά Requirements

iOS 10.0+ Xcode 10.1+ Swift 4.2+

πŸ“± Features

  • β˜‘ Multiple snap-point
  • β˜‘ Smooth integration with dragging and UIScrollView's scrolling.
  • β˜‘ Tracking UIScrollView automatically
  • β˜‘ Set UIScrollView to track manually
  • β˜‘ Use UIViewPropertyAnimator between snap-points.

πŸ‘¨πŸ»β€πŸ’» Usage

Present inline

let rideauView = RideauView(frame: .zero) { (config) in
  config.snapPoints = [.autoPointsFromBottom, .fraction(0.6), .fraction(1)]
}
  
let someView = ...

rideauView.containerView.set(bodyView: container.view, options: .strechDependsVisibleArea)

Present with Modal Presentation


let targetViewController: YourViewController = ...

let controller = RideauViewController(
  bodyViewController: targetViewController,
  configuration: {
    var config = RideauView.Configuration()
    config.snapPoints = [.autoPointsFromBottom, .fraction(1)]
    return config
}(),
  initialSnapPoint: .autoPointsFromBottom
)

present(controller, animated: true, completion: nil)

Multiple SnapPoints

We can define snap-point with RideauSnapPoint.

public enum RideauSnapPoint : Hashable {
  
  case fraction(CGFloat)
  case pointsFromTop(CGFloat)
  case pointsFromBottom(CGFloat)
  case autoPointsFromBottom
}
config.snapPoints = [.pointsFromBottom(200), .fraction(0.5), .fraction(0.8), .fraction(1)]

βš™οΈ Details

RideauContainerView has two ways of resizing content view which is added.

  • RideauContainerView.ResizingOption
    • noResize
    • resizeToVisibleArea
final class RideauContainerView : UIView {
  public func set(bodyView: UIView, resizingOption: ResizingOption)
}

πŸ”Œ Components

Rideau provides the following components that may help us.

RideauMaskedCornerRoundedViewController

A Container view controller that implements masked rounded corner interface and has some options.

  • ☐ More customizable
let targetViewController: YourViewController = ...
let toDisplayViewController = RideauMaskedCornerRoundedViewController(viewController: targetViewController)

let controller = RideauViewController(
  bodyViewController: RideauMaskedCornerRoundedViewController(viewController: target),
  ...

RideauMaskedCornerRoundedView

  • ☐ More customizable

RideauThumbView

  • ☐ More customizable

Installation

CocoaPods

Rideau is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Rideau'

Carthage

For Carthage, add the following to your Cartfile:

github "muukii/Rideau"

What's using Rideau

Author

Contributors

SwiftUI Edition

https://github.com/nerdsupremacist/Snap

License

Rideau is released under the MIT license.

GitHub

link
Stars: 445
Last commit: 17 hours ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Dependencies

Release Notes

17 hours ago

Number of PRs : 4

tag number of PRs

Group: Enhancement (1)

  • Add init argment to switch pan gesture of backdrop view #43 by @shima11

Other (3)

  • 2.0 - better stability #46 by @muukii
  • Cleanup states #45 by @muukii
  • Rename RideauContainerView -> RideauContentContainerView #44 by @muukii

Generated by chglog

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics