Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:nodes-ios/Drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
anho committed Apr 11, 2019
2 parents 26607c2 + 1015091 commit fa439e3
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 32 deletions.
Binary file modified Drawer.framework.zip
Binary file not shown.
16 changes: 9 additions & 7 deletions Drawer/Drawer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,18 @@
TargetAttributes = {
42321BEE2226973500CE1DCB = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1010;
LastSwiftMigration = 1020;
};
42321BF72226973500CE1DCB = {
CreatedOnToolsVersion = 10.1;
};
42321C942226BD1000CE1DCB = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1020;
};
42321CA72226BD1100CE1DCB = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1020;
TestTargetID = 42321C942226BD1000CE1DCB;
};
};
Expand Down Expand Up @@ -674,7 +676,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -700,7 +702,7 @@
PRODUCT_BUNDLE_IDENTIFIER = dk.nodes.Drawer;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down Expand Up @@ -758,7 +760,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = dk.nodes.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -778,7 +780,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = dk.nodes.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -799,7 +801,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = dk.nodes.ExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
Expand All @@ -821,7 +823,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = dk.nodes.ExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
Expand Down
2 changes: 1 addition & 1 deletion Drawer/Drawer/Drawer/DrawerModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public enum Drawer {

public enum State: Int {
case fullSize
case minimised
case minimized
}

internal enum ContainerInteraction: Int {
Expand Down
22 changes: 11 additions & 11 deletions Drawer/Drawer/Drawer/DrawerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class DrawerViewController: UIViewController { //swiftlint:disable:this t
// MARK: States

private var isInitiated: Bool = false
private var state: Drawer.State = .minimised
private var state: Drawer.State = .minimized
private var backgroundInteraction: Drawer.ContainerInteraction = .whenMinimised

// MARK: Drawer possible backgrounds
Expand Down Expand Up @@ -217,7 +217,7 @@ extension DrawerViewController {
switch state {
case .fullSize:
direction = fourDecimal(fractionComplete) >= fourDecimal(lastFractionComplete) ? .down : .up
case .minimised:
case .minimized:
fractionComplete *= -1
direction = fourDecimal(fractionComplete) >= fourDecimal(lastFractionComplete) ? .up : .down
}
Expand Down Expand Up @@ -259,7 +259,7 @@ extension DrawerViewController {

case .ended:
// normal animation conditions
if state == .fullSize && direction == .down || state == .minimised && direction == .up {
if state == .fullSize && direction == .down || state == .minimized && direction == .up {
switch state {
case .fullSize:
switch direction {
Expand All @@ -270,7 +270,7 @@ extension DrawerViewController {
}
default: break
}
case .minimised:
case .minimized:
switch direction {
case .up?:
if runningAnimators[0].isReversed {
Expand All @@ -292,7 +292,7 @@ extension DrawerViewController {
}
default: break
}
case .minimised:
case .minimized:
switch direction {
case .down?:
if !runningAnimators[0].isReversed {
Expand Down Expand Up @@ -394,7 +394,7 @@ extension DrawerViewController {
}

private func closeDrawer(animated: Bool = true, completion: (() -> Void)? = nil) {
state = .minimised
state = .minimized
setupClosedConstraints()

//allow for scrolling in ContentVC
Expand All @@ -417,7 +417,7 @@ extension DrawerViewController {
}

private func dismiss(completion: (() -> Void)? = nil) {
state = .minimised
state = .minimized
setupDismissConstraints()

UIView.animate(withDuration: animationDuration, delay: 0, usingSpringWithDamping: damping, initialSpringVelocity: 0, options: [.beginFromCurrentState], animations: { [weak self] in
Expand Down Expand Up @@ -457,7 +457,7 @@ extension DrawerViewController {
switch state {
case .fullSize:
direction = .down
case .minimised:
case .minimized:
direction = .up
}

Expand All @@ -470,7 +470,7 @@ extension DrawerViewController {
self.setupClosedConstraints()
self.roundCorners(with: self.cornerRadius.minimised)
self.handleCloseBackgroundAnimation()
case .minimised:
case .minimized:
self.contentViewController?.willChangeState(to: .fullSize)
self.setupOpenConstraints()
self.roundCorners(with: self.cornerRadius.fullSize)
Expand All @@ -482,7 +482,7 @@ extension DrawerViewController {
animator.addCompletion { position in
switch self.direction {
case .down?:
self.closeDrawer(animated: self.state == .minimised)
self.closeDrawer(animated: self.state == .minimized)
case .up?:
self.openDrawer(animated: self.state == .fullSize)
default: break
Expand All @@ -505,7 +505,7 @@ extension DrawerViewController {
switch state {
case .fullSize:
openDrawer()
case .minimised:
case .minimized:
closeDrawer()
}
}
Expand Down
14 changes: 9 additions & 5 deletions Drawer/Example/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -11,15 +15,15 @@
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
<point key="canvasLocation" x="113" y="374"/>
</scene>
</scenes>
</document>
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="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="bGC-4z-Bbk">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -19,7 +19,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KrY-LZ-cE5">
<rect key="frame" x="15" y="35" width="345" height="617"/>
<rect key="frame" x="15" y="79" width="345" height="524"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
Expand All @@ -35,9 +35,47 @@
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<navigationItem key="navigationItem" id="lAp-ZC-xXU"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2015.2" y="133.5832083958021"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="kUN-TZ-b8k">
<objects>
<tabBarController automaticallyAdjustsScrollViewInsets="NO" id="bGC-4z-Bbk" sceneMemberID="viewController">
<toolbarItems/>
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="L2X-xg-tkg">
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tabBar>
<connections>
<segue destination="dMf-jI-6s1" kind="relationship" relationship="viewControllers" id="8GW-fM-FBT"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="26M-Ck-JDm" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="136.80000000000001" y="133.5832083958021"/>
</scene>
<!--Item-->
<scene sceneID="lcb-V0-43F">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="dMf-jI-6s1" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="ZqE-18-tkL"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="CB7-7S-P3g">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="TZE-2X-5Nf"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="AM8-jD-YGX" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1076" y="133.5832083958021"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

drawer = DrawerCoordinator(contentViewController: contentVC,
backgroundViewController: self,
drawerBackgroundType: .withColor(UIColor.black.withAlphaComponent(0.5)))
backgroundViewController: self.tabBarController!,
drawerBackgroundType: .withColor(UIColor.black.withAlphaComponent(0.5)))
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ContentViewController: UIViewController {
private func adjustDrawer(with maxHeight: CGFloat, with minHeight: CGFloat) {
let contentConfiguration = Drawer.ContentConfiguration(duration: animationDuration,
embeddedFullHeight: maxHeight,
state: .minimised,
state: .minimized,
embeddedMinimumHeight: minHeight,
cornerRadius: Drawer.ContentConfiguration.CornerRadius(fullSize: 20, minimised: 0),
dismissCompleteCallback:
Expand Down Expand Up @@ -154,7 +154,7 @@ extension ContentViewController: Embeddable {
collapseButton.alpha = 1 - progress
expandButton.alpha = progress
titleAnimator.fractionComplete = progress
case .minimised:
case .minimized:
collapseButton.alpha = progress
expandButton.alpha = 1 - progress
titleAnimator.fractionComplete = progress
Expand Down

0 comments on commit fa439e3

Please sign in to comment.