Skip to content

Commit

Permalink
DrawerKit 0.3.4 (#42) (#44)
Browse files Browse the repository at this point in the history
This PR brings master to version 0.3.4 by adding the following change:

Adds a new configuration parameter for the handle view, namely, its vertical position with respect to the presented view's frame.
  • Loading branch information
wltrup authored and RuiAAPeres committed Nov 15, 2017
1 parent 5a3eccd commit 1236a46
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# DrawerKit

## v. 0.3.4

- Adds a new configuration parameter for the handle view, namely, its vertical position with respect to the presented view's frame.

## v. 0.3.3

- Fixes an issue where the presented view controller's view might not be laid out properly by the time the drawer's height is requested from it.
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.3"
s.version = "0.3.4"
s.summary = "An implementation of an interactive and animated view, similar to what you see in Apple Maps"

s.description = <<-DESC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ extension PresentationController {
handleView.widthAnchor.constraint(equalToConstant: handleConfig.size.width),
handleView.heightAnchor.constraint(equalToConstant: handleConfig.size.height),
handleView.centerXAnchor.constraint(equalTo: presentedView.centerXAnchor),
handleView.topAnchor.constraint(equalTo: presentedView.topAnchor, constant: 8)
handleView.topAnchor.constraint(equalTo: presentedView.topAnchor, constant: handleConfig.top)
])
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@ public struct HandleViewConfiguration {
/// `CGSize(width: 40, height: 6)`.
public var size: CGSize

/// The handle view's vertical distance from the top of the drawer. In other words,
/// the constant to be used when setting up the layout constraint
/// `handleView.topAnchor.constraint(equalTo: presentedView.topAnchor, constant: top)`
/// The default value is 8 points.
public var top: CGFloat

/// The handle view's corner radius. The default is `CornerRadius.automatic`, which
/// results in a corner radius equal to half the handle view's height.
public var cornerRadius: CornerRadius

public init(autoAnimatesDimming: Bool = true,
backgroundColor: UIColor = .gray,
size: CGSize = CGSize(width: 40, height: 6),
top: CGFloat = 8,
cornerRadius: CornerRadius = .automatic) {
self.autoAnimatesDimming = autoAnimatesDimming

Expand All @@ -57,6 +64,8 @@ public struct HandleViewConfiguration {
self.size = validatedSize
}

self.top = max(0, top)

switch cornerRadius {
case .automatic:
self.cornerRadius = .automatic
Expand All @@ -70,6 +79,7 @@ extension HandleViewConfiguration: Equatable {
public static func ==(lhs: HandleViewConfiguration, rhs: HandleViewConfiguration) -> Bool {
return lhs.autoAnimatesDimming == rhs.autoAnimatesDimming
&& lhs.backgroundColor == rhs.backgroundColor
&& lhs.top == rhs.top
&& lhs.size == rhs.size
&& lhs.cornerRadius == rhs.cornerRadius
}
Expand Down
1 change: 1 addition & 0 deletions DrawerKitDemo/DrawerKitDemo/PresenterViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private extension PresenterViewController {