Skip to content

Commit

Permalink
updated interactionMode and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Boldt committed Dec 5, 2018
1 parent 45f9e3a commit 223f1a4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Example/Jelly/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class MainViewController: UIViewController {
case .coverMenuFromRightCanvas:()
let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
let viewControllerToPresent = storyboard.instantiateViewController(withIdentifier: "PresentMe")
let interactionConfiguration = InteractionConfiguration(presentingViewController: self, completionThreshold: 0.5, dragMode: .canvas, mode: .dismiss)
let interactionConfiguration = InteractionConfiguration(presentingViewController: self, completionThreshold: 0.5, dragMode: .canvas)
let uiConfiguration = PresentationUIConfiguration(backgroundStyle: .blurred(effectStyle: .light))
let size = PresentationSize(width: .halfscreen, height: .fullscreen)
let alignment = PresentationAlignment(vertical: .center, horizontal: .left)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class InteractionController: UIPercentDrivenInteractiveTransition {
private func prepareGestureRecognizers() {
switch (presentationType, configuration.dragMode) {
case (.show, .canvas), (.show, .edge):
if configuration.mode.contains(.presentation){
if configuration.mode.contains(.present){
guard let view = presentingViewController?.view else { break }
addInteractionGestureRecognizer(to: view)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public struct InteractionConfiguration {

weak var presentingViewController: UIViewController!

public init(presentingViewController: UIViewController, completionThreshold: CGFloat = 0.5, dragMode: DragMode, mode: InteractionMode = .both) {
public init(presentingViewController: UIViewController, completionThreshold: CGFloat = 0.5, dragMode: DragMode, mode: InteractionMode = [.dismiss, .present] ) {
self.completionThreshold = completionThreshold
self.dragMode = dragMode
self.presentingViewController = presentingViewController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ public struct InteractionMode: OptionSet {
self.rawValue = rawValue
}

public static let presentation = InteractionMode(rawValue: 1 << 0)
public static let present = InteractionMode(rawValue: 1 << 0)
public static let dismiss = InteractionMode(rawValue: 1 << 1)

public static let both: InteractionMode = [.presentation, .dismiss]
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ Here 3 parameters play an important role. First, the `completionThreshold`, whic
The second parameter is the actual type of interaction. Jelly offers the `.edge` and the `.canvas` type.
In an `.edge` transition, the user must execute the gesture from the edge of the screen.
When using the `.canvas` type, gesture recognizers are configured so that direct interaction with the presenting and presented view leads to the transition.
The last parameter is called `mode`. Using the mode you can limit the interaction to presentation or dismiss interaction (default = `.both`).
The last parameter is called `mode`. Using the mode you can limit the interaction to presentation or dismiss interaction (default = `[.present,.dismiss]`).

```swift
let viewController = YourViewController()
let interaction = InteractionConfiguration(presentingViewController: self, completionThreshold: 0.5, dragMode: .edge, mode: .both)
let interaction = InteractionConfiguration(presentingViewController: self, completionThreshold: 0.5, dragMode: .edge, mode: .dismiss)
let presentation = SlidePresentation(direction: .right, interactionConfiguration: interaction)
let animator = Animator(presentation: presentation)
animator.prepare(presentedViewController: viewController)
Expand Down Expand Up @@ -135,7 +135,7 @@ The presentation types can be configured with various settings:
* `completion threshold`
* `interactive drag mode` (edge or pan)
* `interaction mode` (present, dismiss)
* `parallax`
* `parallax` (Just available on slide Presentations)

Each component is explained in more detail in the <a href="https://github.com/SebastianBoldt/Jelly/wiki/Customization
">Jelly Wiki</a>.
Expand Down

0 comments on commit 223f1a4

Please sign in to comment.