diff --git a/CHANGELOG.md b/CHANGELOG.md index e3d5e56..c886f53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # DrawerKit +## v. 0.4.1 + +- Reverses the fix for the [issue](https://github.com/Babylonpartners/DrawerKit/issues/31) about safe areas. The fix broke other things and the issue will need to be re-opened. +- Changes the minimum deployment target to 10.2. + ## v. 0.4.0 - Drawers can now have borders and shadows, all configurable. diff --git a/DrawerKit.podspec b/DrawerKit.podspec index c4055d3..74bee8a 100644 --- a/DrawerKit.podspec +++ b/DrawerKit.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "DrawerKit" - s.version = "0.4.0" + s.version = "0.4.1" s.summary = "An implementation of an interactive and animated view, similar to what you see in Apple Maps" s.description = <<-DESC diff --git a/DrawerKit/DrawerKit.xcodeproj/project.pbxproj b/DrawerKit/DrawerKit.xcodeproj/project.pbxproj index 2f5bd38..e078d3a 100644 --- a/DrawerKit/DrawerKit.xcodeproj/project.pbxproj +++ b/DrawerKit/DrawerKit.xcodeproj/project.pbxproj @@ -343,7 +343,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -397,7 +397,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; diff --git a/DrawerKit/DrawerKit/Internal API/AnimationController.swift b/DrawerKit/DrawerKit/Internal API/AnimationController.swift index 771e1cb..201893d 100644 --- a/DrawerKit/DrawerKit/Internal API/AnimationController.swift +++ b/DrawerKit/DrawerKit/Internal API/AnimationController.swift @@ -29,8 +29,7 @@ extension AnimationController: UIViewControllerAnimatedTransitioning { func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { let (presentingVC, presentedVC) = viewControllers(transitionContext, isPresentation) if isPresentation { - let controller = presentedVC.presentationController as! PresentationController - controller.intermediate.view.addSubview(presentedVC.view) + transitionContext.containerView.addSubview(presentedVC.view) } let duration = transitionDuration(using: transitionContext) diff --git a/DrawerKit/DrawerKit/Internal API/PresentationController+Properties.swift b/DrawerKit/DrawerKit/Internal API/PresentationController+Properties.swift index 5bf15ba..ef41003 100644 --- a/DrawerKit/DrawerKit/Internal API/PresentationController+Properties.swift +++ b/DrawerKit/DrawerKit/Internal API/PresentationController+Properties.swift @@ -80,8 +80,6 @@ extension PresentationController { presentedView?.layer.cornerRadius = radius if #available(iOS 11.0, *) { presentedView?.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner] - } else { - presentedView?.roundCorners([.topLeft, .topRight], radius: radius) } } } diff --git a/DrawerKit/DrawerKit/Internal API/PresentationController+Utilities.swift b/DrawerKit/DrawerKit/Internal API/PresentationController+Utilities.swift index 6240642..ba882fa 100644 --- a/DrawerKit/DrawerKit/Internal API/PresentationController+Utilities.swift +++ b/DrawerKit/DrawerKit/Internal API/PresentationController+Utilities.swift @@ -33,15 +33,3 @@ extension DrawerState { } } } - -// For versions of iOS lower than 11.0 -extension UIView { - func roundCorners(_ corners: UIRectCorner, radius: CGFloat) { - let path = UIBezierPath(roundedRect: self.bounds, - byRoundingCorners: corners, - cornerRadii: CGSize(width: radius, height: radius)) - let mask = CAShapeLayer() - mask.path = path.cgPath - self.layer.mask = mask - } -} diff --git a/DrawerKit/DrawerKit/Internal API/PresentationController.swift b/DrawerKit/DrawerKit/Internal API/PresentationController.swift index 66d10b9..47cf651 100644 --- a/DrawerKit/DrawerKit/Internal API/PresentationController.swift +++ b/DrawerKit/DrawerKit/Internal API/PresentationController.swift @@ -13,8 +13,6 @@ final class PresentationController: UIPresentationController { var drawerDragGR: UIPanGestureRecognizer? var lastDrawerState: DrawerState = .collapsed - let intermediate: UIViewController - init(presentingVC: UIViewController?, presentingDrawerAnimationActions: DrawerAnimationActions, presentedVC: UIViewController, @@ -26,15 +24,12 @@ final class PresentationController: UIPresentationController { self.handleView = (configuration.handleViewConfiguration != nil ? UIView() : nil) self.presentingDrawerAnimationActions = presentingDrawerAnimationActions self.presentedDrawerAnimationActions = presentedDrawerAnimationActions - self.intermediate = UIViewController() super.init(presentedViewController: presentedVC, presenting: presentingVC) - - intermediate.view.translatesAutoresizingMaskIntoConstraints = false } } extension PresentationController { - private var frameOfPresentedViewInIntermediateView: CGRect { + override var frameOfPresentedViewInContainerView: CGRect { var frame: CGRect = .zero frame.size = size(forChildContentContainer: presentedViewController, withParentContainerSize: containerViewSize) @@ -60,25 +55,17 @@ extension PresentationController { addCornerRadiusAnimationEnding(at: .partiallyExpanded) enableDrawerFullExpansionTapRecogniser(enabled: false) enableDrawerDismissalTapRecogniser(enabled: false) - - containerView?.addSubview(intermediate.view) - intermediate.view.frame = frameOfPresentedViewInContainerView - intermediate.view.backgroundColor = .clear - - intermediate.addChildViewController(presentedViewController) } override func presentationTransitionDidEnd(_ completed: Bool) { enableDrawerFullExpansionTapRecogniser(enabled: true) enableDrawerDismissalTapRecogniser(enabled: true) - presentedViewController.didMove(toParentViewController: intermediate) } override func dismissalTransitionWillBegin() { addCornerRadiusAnimationEnding(at: .collapsed) enableDrawerFullExpansionTapRecogniser(enabled: false) enableDrawerDismissalTapRecogniser(enabled: false) - presentedViewController.willMove(toParentViewController: nil) } override func dismissalTransitionDidEnd(_ completed: Bool) { @@ -86,12 +73,9 @@ extension PresentationController { removeDrawerDismissalTapRecogniser() removeDrawerDragRecogniser() removeHandleView() - presentedViewController.removeFromParentViewController() - intermediate.view.removeFromSuperview() } override func containerViewWillLayoutSubviews() { - intermediate.view.frame = frameOfPresentedViewInContainerView - presentedView?.frame = frameOfPresentedViewInIntermediateView + presentedView?.frame = frameOfPresentedViewInContainerView } } diff --git a/DrawerKitDemo/DrawerKitDemo.xcodeproj/project.pbxproj b/DrawerKitDemo/DrawerKitDemo.xcodeproj/project.pbxproj index d28a990..c08bc20 100644 --- a/DrawerKitDemo/DrawerKitDemo.xcodeproj/project.pbxproj +++ b/DrawerKitDemo/DrawerKitDemo.xcodeproj/project.pbxproj @@ -326,7 +326,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -377,7 +377,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; + IPHONEOS_DEPLOYMENT_TARGET = 10.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; diff --git a/DrawerKitDemo/DrawerKitDemo/PresenterViewController.swift b/DrawerKitDemo/DrawerKitDemo/PresenterViewController.swift index ba45dfd..3644a44 100644 --- a/DrawerKitDemo/DrawerKitDemo/PresenterViewController.swift +++ b/DrawerKitDemo/DrawerKitDemo/PresenterViewController.swift @@ -46,16 +46,16 @@ private extension PresenterViewController { handleViewConfiguration.cornerRadius = .automatic configuration.handleViewConfiguration = handleViewConfiguration - let borderColor = UIColor(red: 205.0/255.0, green: 206.0/255.0, blue: 210.0/255.0, alpha: 1) + let borderColor = UIColor(red: 1, green: 0, blue: 0, alpha: 1) let drawerBorderConfiguration = DrawerBorderConfiguration(borderThickness: 0.5, borderColor: borderColor) - configuration.drawerBorderConfiguration = drawerBorderConfiguration + configuration.drawerBorderConfiguration = drawerBorderConfiguration // default is nil - let drawerShadowConfiguration = DrawerShadowConfiguration(shadowOpacity: 0.25, - shadowRadius: 4, + let drawerShadowConfiguration = DrawerShadowConfiguration(shadowOpacity: 0.75, + shadowRadius: 10, shadowOffset: .zero, - shadowColor: .black) - configuration.drawerShadowConfiguration = drawerShadowConfiguration + shadowColor: .red) + configuration.drawerShadowConfiguration = drawerShadowConfiguration // default is nil drawerDisplayController = DrawerDisplayController(presentingViewController: self, presentedViewController: vc, diff --git a/DrawerKitDemo/DrawerKitDemo/Storyboards/Base.lproj/Main.storyboard b/DrawerKitDemo/DrawerKitDemo/Storyboards/Base.lproj/Main.storyboard index e6a35e6..05dbe13 100644 --- a/DrawerKitDemo/DrawerKitDemo/Storyboards/Base.lproj/Main.storyboard +++ b/DrawerKitDemo/DrawerKitDemo/Storyboards/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -138,7 +138,7 @@ - + diff --git a/README.md b/README.md index 0ab9c82..85a031b 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,11 @@ Please do play with the demo app and try different configuration options because

+
+ + DrawerKit + + DrawerKit @@ -36,6 +41,12 @@ Please do play with the demo app and try different configuration options because

+## What's new in version 0.4.1? + +- Reverses the fix for the [issue](https://github.com/Babylonpartners/DrawerKit/issues/31) about safe areas. +The fix broke other things and the issue will need to be re-opened. +- Changes the minimum deployment target to 10.2. + ## What's new in version 0.4.0? - Drawers can now have borders and shadows, all configurable. diff --git a/drawers1.gif b/drawers1.gif new file mode 100644 index 0000000..364d759 Binary files /dev/null and b/drawers1.gif differ diff --git a/drawers2.gif b/drawers2.gif index 364d759..29ee3cf 100644 Binary files a/drawers2.gif and b/drawers2.gif differ diff --git a/drawers3.gif b/drawers3.gif index 29ee3cf..430f295 100644 Binary files a/drawers3.gif and b/drawers3.gif differ