Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DrawerKit release 0.3.1 #37

Merged
merged 103 commits into from
Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
4be3003
Added git ignore file
wltrup Oct 11, 2017
b392cca
Added project workspace
wltrup Oct 11, 2017
4895d95
Added tab bar template project
wltrup Oct 11, 2017
632633d
Added DrawerKit empty framework
wltrup Oct 11, 2017
5c186e9
Added basic view controllers and storyboards
wltrup Oct 11, 2017
aa0f36f
Fixed broken outlets
wltrup Oct 11, 2017
1e79e2f
Added implementation of DrawerKit. A few bits to complete still.
wltrup Oct 11, 2017
752abad
Hooked up the view controllers to the custom presentation.
wltrup Oct 11, 2017
3c0b91c
Added clamping to the three possible resting positions of the drawer
wltrup Oct 11, 2017
878ca27
Added more configuration to the presenting VC
wltrup Oct 11, 2017
0255cbe
Fixed a few glitches related to allowing partial expansion or not, an…
wltrup Oct 11, 2017
5ff1a8a
Removed the two timing configurations and now using only one for all …
wltrup Oct 11, 2017
8c83b60
Added support for not having the gesture recognisers.
wltrup Oct 12, 2017
55da51d
Fixed a potential division by zero.
wltrup Oct 12, 2017
dbcf49e
Adding more configuration controls to presenting VC. WIP.
wltrup Oct 12, 2017
6e98524
Added debug mode.
wltrup Oct 12, 2017
dced881
Added some TODOs
wltrup Oct 12, 2017
a422b3d
Renamed a function to make it clear it's a debugging feature.
wltrup Oct 12, 2017
3e736d1
Minor refactoring.
wltrup Oct 12, 2017
f9ec01e
Renamed some source files for better clarity of intention.
wltrup Oct 12, 2017
a0baa3b
Removed source headers.
wltrup Oct 12, 2017
39ca74d
Changed the presented VC to make a larger drawer (easier to play with).
wltrup Oct 12, 2017
69bf74f
Changed some parameters as per Sam's input.
wltrup Oct 12, 2017
88def74
Improved behaviour of corner rounding at the two edges of the screen.…
wltrup Oct 12, 2017
c15c77f
Made the logic for the drawer behaviour easier to read, because Serge…
wltrup Oct 12, 2017
4d18a70
Moved some code closer to where it's actually used.
wltrup Oct 12, 2017
21c030e
Minor formatting.
wltrup Oct 12, 2017
04cd82c
Added a fix to the corner-radius animation issue whereby the corner r…
wltrup Oct 12, 2017
1801863
Disabled automatic code signing.
wltrup Oct 12, 2017
2490d08
The heights of the bands surrounding the resting position of the draw…
wltrup Oct 12, 2017
b1afd54
Oopsie... committed a compiler error. Fixed now.
wltrup Oct 12, 2017
79261da
Added a scrollview to the presented view controller in the demo app, …
wltrup Oct 12, 2017
d8d2271
Added an interaction controller, the first step in fixing the non-int…
wltrup Oct 12, 2017
bb5377f
Renamed TransitionAnimator to AnimationController.
wltrup Oct 12, 2017
e90bf24
Renamed a file to match the extension it's about.
wltrup Oct 12, 2017
4ecf66c
Duh, it was supposed to be AnimationController, not AnimatorController.
wltrup Oct 12, 2017
ac7c5ff
Implemented interactive controller for the presentation and dismissal…
wltrup Oct 12, 2017
6787d07
Added license file and CocoaPods podspec. Not passing lint just yet.
wltrup Oct 13, 2017
eebde02
Removed indirect access to configuration parameters.
wltrup Oct 13, 2017
d15f081
Removed currently unused source file TransitionGeometry.
wltrup Oct 13, 2017
37c1aad
Fixed company name in the license file.
wltrup Oct 13, 2017
88cf9dc
Cleared the team entry in the demo app.
wltrup Oct 13, 2017
907befc
Demo app: adding controls for all the configurable parameters. WIP.
wltrup Oct 14, 2017
63233cd
Added control for manipulating cubic Bezier control points, CubicBezi…
wltrup Oct 15, 2017
1833625
Added all the controls to the presenter VC.
wltrup Oct 15, 2017
bb77e30
Fixed a TODO comment.
wltrup Oct 15, 2017
ab99b5e
Make sure that durationInSeconds is a positive value.
wltrup Oct 15, 2017
2ec596d
Removed all references to coversStatusBar since that hasn't been impl…
wltrup Oct 15, 2017
7b2a304
Make sure that flickSpeedThreshold is a non-negative value. Also, if …
wltrup Oct 15, 2017
355d67a
Make sure that upperMarkGap and lowerMarkGap are non-negative values.
wltrup Oct 15, 2017
a3f545b
Only add debugging mark lines if at least one of upperMarkGap and low…
wltrup Oct 15, 2017
7efb133
Make sure that maximumCornerRadius is a non-negative value.
wltrup Oct 15, 2017
01b1974
Only animate the corner radius if maximumCornerRadius is strictly pos…
wltrup Oct 15, 2017
53476c3
Make sure that numberOfTapsForOutsideDrawerDismissal is a non-negativ…
wltrup Oct 15, 2017
3cabcd6
Resolved an issue with animating rounding the presented view corners.
wltrup Oct 15, 2017
412a27e
Simplified the demo app to its bare essentials. No more configuration…
wltrup Oct 15, 2017
f52a637
Added based documentation to the library.
wltrup Oct 15, 2017
d6734eb
Preliminary version of README. WIP.
wltrup Oct 15, 2017
a1ff7d7
Removed unused assets.
wltrup Oct 15, 2017
0dda897
Added some pseudo-code to the README, to explain the presentation/dis…
wltrup Oct 16, 2017
882795b
Code style change.
wltrup Oct 16, 2017
d096649
Removed unnecessary [weak self] capture lists.
wltrup Oct 16, 2017
f590dc8
Changed default value of durationInSeconds from 0.8 to 0.3 seconds.
wltrup Oct 16, 2017
59fb582
Fixed a botched global search/replace in DrawerConfiguration+Equatable.
wltrup Oct 16, 2017
561b449
Renamed evil local gr variables to less evil names.
wltrup Oct 16, 2017
557798a
Fixed guard statements as per comments.
wltrup Oct 16, 2017
c3b09d6
Removed a comment.
wltrup Oct 16, 2017
d42f7c7
Removed a protocol extension.
wltrup Oct 16, 2017
60085af
Make sure that the height of the partially expanded drawer is non-neg…
wltrup Oct 16, 2017
e4fa1c7
Added documentation to all exposed public entities.
wltrup Oct 16, 2017
6a3e3fd
Style change as per comments.
wltrup Oct 16, 2017
942318c
Fixed documentation.
wltrup Oct 16, 2017
eb46380
Updated README file.
wltrup Oct 16, 2017
a2883fc
Tweaked the README file.
wltrup Oct 16, 2017
56bc186
Decreased the deployment target requirement, from 10.3 to 10.0.
wltrup Oct 16, 2017
9b4ba38
Removed hidden extension in the LICENSE file.
wltrup Oct 16, 2017
ed3decd
Fixed source_files entry in the podspec. Removed the exclude_files en…
wltrup Oct 16, 2017
7fb4034
Added a .swift-version file with the appropriate version of Swift to …
wltrup Oct 16, 2017
d9d81f5
Fixed the homepage in the podspec.
wltrup Oct 16, 2017
122463f
Fixed a bug when running under iOS 10 in which the initial presentati…
wltrup Oct 16, 2017
f1338bf
Style change.
wltrup Oct 16, 2017
12c5940
Killed the use of IUO references.
wltrup Oct 16, 2017
df37082
Changed author email address in the podspec.
wltrup Oct 16, 2017
21e39d4
Added support for Carthage.
wltrup Oct 17, 2017
b1a2f1a
[ci skip] Removed a commented out section from the README. Also, an e…
wltrup Oct 17, 2017
15b789f
Merge pull request #2 from Babylonpartners/intro
andersio Oct 17, 2017
baf0b65
Added CircleCI config file. (#9)
wltrup Oct 17, 2017
f7bbc42
Fixed podspec source item. (#12)
wltrup Oct 17, 2017
01f710b
DrawerKit release 0.0.1 (#13) (#14)
wltrup Oct 17, 2017
1898b58
Add gif and fixes the circle CI badge. (#17)
wltrup Oct 17, 2017
252ae8a
Changes version from 0.0.1 to 0.1. (#18)
wltrup Oct 17, 2017
f845cab
Merge branch 'master' into develop
wltrup Oct 17, 2017
d8d3c9f
Add missing link to Carthage (#15)
Palleas Oct 17, 2017
366928f
Merge remote-tracking branch 'origin/master' into develop
wltrup Oct 17, 2017
aee9a6f
Fix to README (#21)
wltrup Oct 18, 2017
c4f48dc
Add 4 UI tests to check the Drawer Kit demo app is working (#22)
JasonDobo Oct 18, 2017
142ccb5
Run UI Tests as part of the CircleCI build (#25)
JasonDobo Oct 20, 2017
9c15cf2
Between a branch build and the merge the version available for the si…
JasonDobo Oct 20, 2017
0895ccc
New features (#27)
wltrup Oct 23, 2017
43b202a
New features and preparation for release 0.3.0 (#30)
wltrup Nov 6, 2017
5b4ebfd
Merge master into dev (#32)
wltrup Nov 6, 2017
e7782c1
New features and prep for release 0.3.1 (#36)
wltrup Nov 8, 2017
7e374b7
Merge remote-tracking branch 'origin/develop' into wagner/0.3.1_devel…
wltrup Nov 8, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# DrawerKit

## v. 0.3.1

- Better support for concurrent animations: in previous versions, the actual presenting view controller wasn't necessarily what you'd think is the presenting view controller, which caused problems when trying to animate its view concurrently with the drawer animation. Now, although it's still the case that the presenting view controller may not be the view controller you think it is, the view controller that you think is the presenting view controller and which you add conformance to `DrawerAnimationParticipant` is the view controller whose animation closures get invoked.

- Notifications: it's now possible to subscribe to notifications indicating when the drawer is tapped (both in its interior and in its exterior), when drawer transitions are about to start, and when they're completed.

## v. 0.3.0

Release 0.3.0 breaks backwards compatibility with the earlier releases. Specific changes and new features are as follows:
Expand Down
2 changes: 1 addition & 1 deletion DrawerKit.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "DrawerKit"
s.version = "0.3.0"
s.version = "0.3.1"
s.summary = "An implementation of an interactive and animated view, similar to what you see in Apple Maps"

s.description = <<-DESC
Expand Down
8 changes: 8 additions & 0 deletions DrawerKit/DrawerKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
CB2CB79F1F8E951900AA152D /* AnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2CB79C1F8E951900AA152D /* AnimationController.swift */; };
CB2CB7AD1F8E9D9900AA152D /* DrawerDisplayController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2CB7AC1F8E9D9900AA152D /* DrawerDisplayController+Extensions.swift */; };
CB2CB7AF1F8E9F4C00AA152D /* DrawerDisplayController+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2CB7AE1F8E9F4C00AA152D /* DrawerDisplayController+Configuration.swift */; };
CB3CAFBE1FB248B000AD28A1 /* DrawerNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB3CAFBD1FB248B000AD28A1 /* DrawerNotifications.swift */; };
CB3CAFC01FB24BD800AD28A1 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB3CAFBF1FB24BD800AD28A1 /* Notifications.swift */; };
CB5AF7FC1F9B834E000B2DC9 /* DrawerState.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB5AF7FB1F9B834E000B2DC9 /* DrawerState.swift */; };
CB5AF8001F9BDAC5000B2DC9 /* DrawerAnimationParticipant.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB5AF7FF1F9BDAC5000B2DC9 /* DrawerAnimationParticipant.swift */; };
CB5AF8021F9BDF29000B2DC9 /* DrawerAnimationActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB5AF8011F9BDF29000B2DC9 /* DrawerAnimationActions.swift */; };
Expand Down Expand Up @@ -44,6 +46,8 @@
CB2CB79C1F8E951900AA152D /* AnimationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimationController.swift; sourceTree = "<group>"; };
CB2CB7AC1F8E9D9900AA152D /* DrawerDisplayController+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DrawerDisplayController+Extensions.swift"; sourceTree = "<group>"; };
CB2CB7AE1F8E9F4C00AA152D /* DrawerDisplayController+Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DrawerDisplayController+Configuration.swift"; sourceTree = "<group>"; };
CB3CAFBD1FB248B000AD28A1 /* DrawerNotifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DrawerNotifications.swift; sourceTree = "<group>"; };
CB3CAFBF1FB24BD800AD28A1 /* Notifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = "<group>"; };
CB5AF7FB1F9B834E000B2DC9 /* DrawerState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrawerState.swift; sourceTree = "<group>"; };
CB5AF7FF1F9BDAC5000B2DC9 /* DrawerAnimationParticipant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrawerAnimationParticipant.swift; sourceTree = "<group>"; };
CB5AF8011F9BDF29000B2DC9 /* DrawerAnimationActions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrawerAnimationActions.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -81,6 +85,8 @@
isa = PBXGroup;
children = (
CB2CB79A1F8E951900AA152D /* DrawerDisplayController.swift */,
CB3CAFBD1FB248B000AD28A1 /* DrawerNotifications.swift */,
CB3CAFBF1FB24BD800AD28A1 /* Notifications.swift */,
CB5AF8071F9BE105000B2DC9 /* Protocols */,
CB5AF8081F9BE12E000B2DC9 /* Structs */,
CB5AF8121F9BE9B3000B2DC9 /* Extensions */,
Expand Down Expand Up @@ -250,6 +256,7 @@
CB5AF8061F9BE0E3000B2DC9 /* DrawerGeometry.swift in Sources */,
CB5AF8021F9BDF29000B2DC9 /* DrawerAnimationActions.swift in Sources */,
CB2CB7941F8E934500AA152D /* DrawerPresentable.swift in Sources */,
CB3CAFC01FB24BD800AD28A1 /* Notifications.swift in Sources */,
CB5AF8001F9BDAC5000B2DC9 /* DrawerAnimationParticipant.swift in Sources */,
CB619CEC1F8FFBAD0076E1DE /* InteractionController.swift in Sources */,
CB6F86B81F9C0539000FA37A /* PresentationController+Properties.swift in Sources */,
Expand All @@ -265,6 +272,7 @@
CB6F86BA1F9C05E6000FA37A /* PresentationController+Gestures.swift in Sources */,
CB5AF7FC1F9B834E000B2DC9 /* DrawerState.swift in Sources */,
CB2CB7971F8E934500AA152D /* DrawerConfiguration.swift in Sources */,
CB3CAFBE1FB248B000AD28A1 /* DrawerNotifications.swift in Sources */,
CBFA36F21F9C4004006847BB /* GeometryEvaluator.swift in Sources */,
CB6F86B41F9C036D000FA37A /* PresentationController+Utilities.swift in Sources */,
CB5AF8141F9BEA91000B2DC9 /* DrawerAnimationInfo+Geometry.swift in Sources */,
Expand Down
25 changes: 18 additions & 7 deletions DrawerKit/DrawerKit/Internal API/AnimationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ final class AnimationController: NSObject {
private let isPresentation: Bool
private let configuration: DrawerConfiguration

init(isPresentation: Bool, configuration: DrawerConfiguration) {
let presentingDrawerAnimationActions: DrawerAnimationActions
let presentedDrawerAnimationActions: DrawerAnimationActions

init(isPresentation: Bool,
configuration: DrawerConfiguration,
presentingDrawerAnimationActions: DrawerAnimationActions,
presentedDrawerAnimationActions: DrawerAnimationActions) {
self.isPresentation = isPresentation
self.configuration = configuration
self.presentingDrawerAnimationActions = presentingDrawerAnimationActions
self.presentedDrawerAnimationActions = presentedDrawerAnimationActions
super.init()
}
}
Expand Down Expand Up @@ -58,22 +66,25 @@ extension AnimationController: UIViewControllerAnimatedTransitioning {
duration,
isPresentation)

AnimationSupport.clientPrepareViews(presentingVC: presentingVC,
presentedVC: presentedVC,
let presentingAnimationActions = self.presentingDrawerAnimationActions
let presentedAnimationActions = self.presentedDrawerAnimationActions

AnimationSupport.clientPrepareViews(presentingDrawerAnimationActions: presentingAnimationActions,
presentedDrawerAnimationActions: presentedAnimationActions,
info)
presentedVC.view.frame = initialFrame

animator.addAnimations {
presentedVC.view.frame = finalFrame
AnimationSupport.clientAnimateAlong(presentingVC: presentingVC,
presentedVC: presentedVC,
AnimationSupport.clientAnimateAlong(presentingDrawerAnimationActions: presentingAnimationActions,
presentedDrawerAnimationActions: presentedAnimationActions,
info)
}

animator.addCompletion { endingPosition in
let finished = (endingPosition == UIViewAnimatingPosition.end)
AnimationSupport.clientCleanupViews(presentingVC: presentingVC,
presentedVC: presentedVC,
AnimationSupport.clientCleanupViews(presentingDrawerAnimationActions: presentingAnimationActions,
presentedDrawerAnimationActions: presentedAnimationActions,
endingPosition,
info)
transitionContext.completeTransition(finished)
Expand Down
26 changes: 14 additions & 12 deletions DrawerKit/DrawerKit/Internal API/AnimationSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,29 @@ struct AnimationSupport {
endPosition: endingPosition)
}

static func clientPrepareViews(presentingVC: UIViewController,
presentedVC: UIViewController,
static func clientPrepareViews(presentingDrawerAnimationActions: DrawerAnimationActions,
presentedDrawerAnimationActions: DrawerAnimationActions,
_ info: DrawerAnimationInfo) {
(presentingVC as? DrawerAnimationParticipant)?.drawerAnimationActions.prepare?(info)
(presentedVC as? DrawerAnimationParticipant)?.drawerAnimationActions.prepare?(info)
NotificationCenter.default.post(notification: DrawerNotification.transitionWillStart(info: info))
presentingDrawerAnimationActions.prepare?(info)
presentedDrawerAnimationActions.prepare?(info)
}

static func clientAnimateAlong(presentingVC: UIViewController,
presentedVC: UIViewController,
static func clientAnimateAlong(presentingDrawerAnimationActions: DrawerAnimationActions,
presentedDrawerAnimationActions: DrawerAnimationActions,
_ info: DrawerAnimationInfo) {
(presentingVC as? DrawerAnimationParticipant)?.drawerAnimationActions.animateAlong?(info)
(presentedVC as? DrawerAnimationParticipant)?.drawerAnimationActions.animateAlong?(info)
presentingDrawerAnimationActions.animateAlong?(info)
presentedDrawerAnimationActions.animateAlong?(info)
}

static func clientCleanupViews(presentingVC: UIViewController,
presentedVC: UIViewController,
static func clientCleanupViews(presentingDrawerAnimationActions: DrawerAnimationActions,
presentedDrawerAnimationActions: DrawerAnimationActions,
_ endingPosition: UIViewAnimatingPosition,
_ info: DrawerAnimationInfo) {
var endInfo = info
endInfo.endPosition = endingPosition
(presentingVC as? DrawerAnimationParticipant)?.drawerAnimationActions.cleanup?(info)
(presentedVC as? DrawerAnimationParticipant)?.drawerAnimationActions.cleanup?(info)
presentingDrawerAnimationActions.cleanup?(info)
presentedDrawerAnimationActions.cleanup?(info)
NotificationCenter.default.post(notification: DrawerNotification.transitionDidFinish(info: info))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ extension DrawerDisplayController: UIViewControllerTransitioningDelegate {
presenting: UIViewController?,
source: UIViewController) -> UIPresentationController? {
let presentationController = PresentationController(presentingVC: presentingVC,
presentingDrawerAnimationActions: presentingDrawerAnimationActions,
presentedVC: presented,
presentedDrawerAnimationActions: presentedDrawerAnimationActions,
configuration: configuration,
inDebugMode: inDebugMode)
presentationController.delegate = self
Expand All @@ -15,11 +17,17 @@ extension DrawerDisplayController: UIViewControllerTransitioningDelegate {
public func animationController(forPresented presented: UIViewController,
presenting: UIViewController,
source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return AnimationController(isPresentation: true, configuration: configuration)
return AnimationController(isPresentation: true,
configuration: configuration,
presentingDrawerAnimationActions: presentingDrawerAnimationActions,
presentedDrawerAnimationActions: presentedDrawerAnimationActions)
}

public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return AnimationController(isPresentation: false, configuration: configuration)
return AnimationController(isPresentation: false,
configuration: configuration,
presentingDrawerAnimationActions: presentingDrawerAnimationActions,
presentedDrawerAnimationActions: presentedDrawerAnimationActions)
}

public func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@ extension PresentationController {
let autoAnimatesDimming = configuration.handleViewConfiguration.autoAnimatesDimming
if autoAnimatesDimming { self.handleView?.alpha = handleViewAlpha(at: startingState) }

AnimationSupport.clientPrepareViews(presentingVC: presentingVC,
presentedVC: presentedVC,
let presentingAnimationActions = self.presentingDrawerAnimationActions
let presentedAnimationActions = self.presentedDrawerAnimationActions

AnimationSupport.clientPrepareViews(presentingDrawerAnimationActions: presentingAnimationActions,
presentedDrawerAnimationActions: presentedAnimationActions,
info)

animator.addAnimations {
self.currentDrawerY = endingPositionY
if autoAnimatesDimming { self.handleView?.alpha = endingHandleViewAlpha }
if maxCornerRadius != 0 { self.currentDrawerCornerRadius = endingCornerRadius }
AnimationSupport.clientAnimateAlong(presentingVC: presentingVC,
presentedVC: presentedVC,
AnimationSupport.clientAnimateAlong(presentingDrawerAnimationActions: presentingAnimationActions,
presentedDrawerAnimationActions: presentedAnimationActions,
info)
}

Expand Down Expand Up @@ -84,8 +87,8 @@ extension PresentationController {
self.currentDrawerCornerRadius = 0
}

AnimationSupport.clientCleanupViews(presentingVC: presentingVC,
presentedVC: presentedVC,
AnimationSupport.clientCleanupViews(presentingDrawerAnimationActions: presentingAnimationActions,
presentedDrawerAnimationActions: presentedAnimationActions,
endingPosition,
info)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ extension PresentationController {
guard let tapGesture = drawerFullExpansionTapGR else { return }
let tapY = tapGesture.location(in: presentedView).y
guard tapY < drawerPartialHeight else { return }
NotificationCenter.default.post(notification: DrawerNotification.drawerInteriorTapped)
animateTransition(to: .fullyExpanded)
}

@objc func handleDrawerDismissalTap() {
guard let tapGesture = drawerDismissalTapGR else { return }
let tapY = tapGesture.location(in: containerView).y
guard tapY < currentDrawerY else { return }
NotificationCenter.default.post(notification: DrawerNotification.drawerExteriorTapped)
tapGesture.isEnabled = false
presentedViewController.dismiss(animated: true)
}
Expand Down
7 changes: 7 additions & 0 deletions DrawerKit/DrawerKit/Internal API/PresentationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@ final class PresentationController: UIPresentationController {
let inDebugMode: Bool
let handleView: UIView?

let presentingDrawerAnimationActions: DrawerAnimationActions
let presentedDrawerAnimationActions: DrawerAnimationActions

var drawerFullExpansionTapGR: UITapGestureRecognizer?
var drawerDismissalTapGR: UITapGestureRecognizer?
var drawerDragGR: UIPanGestureRecognizer?
var lastDrawerState: DrawerState = .collapsed

init(presentingVC: UIViewController?,
presentingDrawerAnimationActions: DrawerAnimationActions,
presentedVC: UIViewController,
presentedDrawerAnimationActions: DrawerAnimationActions,
configuration: DrawerConfiguration,
inDebugMode: Bool = false) {
self.configuration = configuration
self.inDebugMode = inDebugMode
self.handleView = (configuration.hasHandleView ? UIView() : nil)
self.presentingDrawerAnimationActions = presentingDrawerAnimationActions
self.presentedDrawerAnimationActions = presentedDrawerAnimationActions
super.init(presentedViewController: presentedVC, presenting: presentingVC)
}
}
Expand Down
16 changes: 16 additions & 0 deletions DrawerKit/DrawerKit/Public API/DrawerDisplayController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public final class DrawerDisplayController: NSObject {
weak var presentingVC: UIViewController?
/* strong */ var presentedVC: (UIViewController & DrawerPresentable)

let presentingDrawerAnimationActions: DrawerAnimationActions
let presentedDrawerAnimationActions: DrawerAnimationActions

let inDebugMode: Bool

/// Initialiser for `DrawerDisplayController`.
Expand All @@ -38,6 +41,19 @@ public final class DrawerDisplayController: NSObject {
self.presentedVC = presentedViewController
self.configuration = configuration
self.inDebugMode = inDebugMode

if let presentingAsDrawerParticipant = presentingViewController as? DrawerAnimationParticipant {
self.presentingDrawerAnimationActions = presentingAsDrawerParticipant.drawerAnimationActions
} else {
self.presentingDrawerAnimationActions = DrawerAnimationActions()
}

if let presentedAsDrawerParticipant = presentedViewController as? DrawerAnimationParticipant {
self.presentedDrawerAnimationActions = presentedAsDrawerParticipant.drawerAnimationActions
} else {
self.presentedDrawerAnimationActions = DrawerAnimationActions()
}

super.init()
presentedViewController.transitioningDelegate = self
presentedViewController.modalPresentationStyle = .custom
Expand Down
Loading