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 0.4.1 release #52

Merged
merged 13 commits into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
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.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
Expand Down
4 changes: 2 additions & 2 deletions DrawerKit/DrawerKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It makes it easier to test DrawerKit in the simulator.

MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -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";
Expand Down
3 changes: 1 addition & 2 deletions DrawerKit/DrawerKit/Internal API/AnimationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
20 changes: 2 additions & 18 deletions DrawerKit/DrawerKit/Internal API/PresentationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand All @@ -60,38 +55,27 @@ 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) {
removeDrawerFullExpansionTapRecogniser()
removeDrawerDismissalTapRecogniser()
removeDrawerDragRecogniser()
removeHandleView()
presentedViewController.removeFromParentViewController()
intermediate.view.removeFromSuperview()
}

override func containerViewWillLayoutSubviews() {
intermediate.view.frame = frameOfPresentedViewInContainerView
presentedView?.frame = frameOfPresentedViewInIntermediateView
presentedView?.frame = frameOfPresentedViewInContainerView
}
}
4 changes: 2 additions & 2 deletions DrawerKitDemo/DrawerKitDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down
12 changes: 6 additions & 6 deletions DrawerKitDemo/DrawerKitDemo/PresenterViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="uBw-Sr-LpF">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="uBw-Sr-LpF">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -138,7 +138,7 @@
<constraint firstItem="Ojr-aM-v38" firstAttribute="top" secondItem="dEa-Pl-yQz" secondAttribute="bottom" constant="20" id="Dgd-aQ-agb"/>
<constraint firstItem="dEa-Pl-yQz" firstAttribute="top" secondItem="69I-et-UOX" secondAttribute="bottom" constant="100" id="Eai-cn-LDj"/>
<constraint firstItem="dEa-Pl-yQz" firstAttribute="leading" secondItem="tAJ-xI-Qxr" secondAttribute="leading" id="Vcw-46-NLg"/>
<constraint firstItem="Jth-UI-73K" firstAttribute="top" secondItem="bMW-fV-gMF" secondAttribute="bottom" constant="8" id="aH2-1L-AcL"/>
<constraint firstItem="Jth-UI-73K" firstAttribute="top" secondItem="tAJ-xI-Qxr" secondAttribute="top" constant="28" id="aH2-1L-AcL"/>
<constraint firstItem="Ojr-aM-v38" firstAttribute="leading" secondItem="tAJ-xI-Qxr" secondAttribute="leadingMargin" constant="10" id="cWU-AN-kgF"/>
<constraint firstItem="qPD-ym-Fa5" firstAttribute="top" secondItem="69I-et-UOX" secondAttribute="bottom" constant="25" id="cpO-2w-akW"/>
<constraint firstAttribute="trailing" secondItem="dEa-Pl-yQz" secondAttribute="trailing" id="gI5-Vo-Tk3"/>
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Please do play with the demo app and try different configuration options because
<p align="center">
<table>
<tr>
<td>
<a href="https://github.com/Babylonpartners/DrawerKit/">
<img src="drawers1.gif" alt="DrawerKit" width="288" height="514" />
</a>
</td>
<td>
<a href="https://github.com/Babylonpartners/DrawerKit/">
<img src="drawers2.gif" alt="DrawerKit" width="288" height="514" />
Expand All @@ -36,6 +41,12 @@ Please do play with the demo app and try different configuration options because
</table>
</p>

## 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.
Expand Down
Binary file added drawers1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified drawers2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified drawers3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.