From 223f1a426798953d304af65db584b6844f96201f Mon Sep 17 00:00:00 2001 From: Sebastian Boldt Date: Wed, 5 Dec 2018 21:29:34 +0100 Subject: [PATCH] updated interactionMode and readme --- Example/Jelly/MainViewController.swift | 2 +- .../Interaction Controllers/InteractionController.swift | 2 +- .../Presentation/InteractionConfiguration.swift | 2 +- .../Models/Configuration/Presentation/InteractionMode.swift | 4 +--- README.md | 6 +++--- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Example/Jelly/MainViewController.swift b/Example/Jelly/MainViewController.swift index d92908e..e75f5f0 100644 --- a/Example/Jelly/MainViewController.swift +++ b/Example/Jelly/MainViewController.swift @@ -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) diff --git a/Jelly/Classes/private/Animators/Interaction Controllers/InteractionController.swift b/Jelly/Classes/private/Animators/Interaction Controllers/InteractionController.swift index 0a42c83..5ded1a6 100644 --- a/Jelly/Classes/private/Animators/Interaction Controllers/InteractionController.swift +++ b/Jelly/Classes/private/Animators/Interaction Controllers/InteractionController.swift @@ -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) } diff --git a/Jelly/Classes/public/Models/Configuration/Presentation/InteractionConfiguration.swift b/Jelly/Classes/public/Models/Configuration/Presentation/InteractionConfiguration.swift index d5bda72..fc60806 100644 --- a/Jelly/Classes/public/Models/Configuration/Presentation/InteractionConfiguration.swift +++ b/Jelly/Classes/public/Models/Configuration/Presentation/InteractionConfiguration.swift @@ -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 diff --git a/Jelly/Classes/public/Models/Configuration/Presentation/InteractionMode.swift b/Jelly/Classes/public/Models/Configuration/Presentation/InteractionMode.swift index c2d4f4c..79af9b7 100644 --- a/Jelly/Classes/public/Models/Configuration/Presentation/InteractionMode.swift +++ b/Jelly/Classes/public/Models/Configuration/Presentation/InteractionMode.swift @@ -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] } diff --git a/README.md b/README.md index 805b850..9f778ae 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 Jelly Wiki.