diff --git a/PanModalDemo.xcodeproj/project.pbxproj b/PanModalDemo.xcodeproj/project.pbxproj index 5199b7d..3c214d9 100644 --- a/PanModalDemo.xcodeproj/project.pbxproj +++ b/PanModalDemo.xcodeproj/project.pbxproj @@ -41,7 +41,7 @@ 943904ED2226366700859537 /* AlertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943904EC2226366700859537 /* AlertViewController.swift */; }; 943904EF2226383700859537 /* NavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943904EE2226383700859537 /* NavigationController.swift */; }; 943904F32226484F00859537 /* UserGroupStackedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943904F22226484F00859537 /* UserGroupStackedViewController.swift */; }; - 944EBA2E227BB7F400C4C97B /* FullScreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 944EBA2D227BB7F400C4C97B /* FullScreenViewController.swift */; }; + 944EBA2E227BB7F400C4C97B /* FullScreenNavController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 944EBA2D227BB7F400C4C97B /* FullScreenNavController.swift */; }; 94795C9B21F0335D008045A0 /* PanModalPresentationDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94795C9A21F0335D008045A0 /* PanModalPresentationDelegate.swift */; }; 94795C9D21F03368008045A0 /* PanContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94795C9C21F03368008045A0 /* PanContainerView.swift */; }; DC13905E216D90D5007A3E64 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC13905D216D90D5007A3E64 /* Assets.xcassets */; }; @@ -113,7 +113,7 @@ 943904EC2226366700859537 /* AlertViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertViewController.swift; sourceTree = ""; }; 943904EE2226383700859537 /* NavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationController.swift; sourceTree = ""; }; 943904F22226484F00859537 /* UserGroupStackedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserGroupStackedViewController.swift; sourceTree = ""; }; - 944EBA2D227BB7F400C4C97B /* FullScreenViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullScreenViewController.swift; sourceTree = ""; }; + 944EBA2D227BB7F400C4C97B /* FullScreenNavController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullScreenNavController.swift; sourceTree = ""; }; 94795C9A21F0335D008045A0 /* PanModalPresentationDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PanModalPresentationDelegate.swift; sourceTree = ""; }; 94795C9C21F03368008045A0 /* PanContainerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PanContainerView.swift; sourceTree = ""; }; DC13905D216D90D5007A3E64 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -251,7 +251,7 @@ 944EBA2C227BB7E100C4C97B /* Full Screen */ = { isa = PBXGroup; children = ( - 944EBA2D227BB7F400C4C97B /* FullScreenViewController.swift */, + 944EBA2D227BB7F400C4C97B /* FullScreenNavController.swift */, ); path = "Full Screen"; sourceTree = ""; @@ -586,7 +586,7 @@ DC139075216D9458007A3E64 /* DimmedView.swift in Sources */, 743CABD322265F2E00634A5A /* ProfileViewController.swift in Sources */, DC139070216D9458007A3E64 /* PanModalPresentationAnimator.swift in Sources */, - 944EBA2E227BB7F400C4C97B /* FullScreenViewController.swift in Sources */, + 944EBA2E227BB7F400C4C97B /* FullScreenNavController.swift in Sources */, DCA741AE216D90410021F2F2 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Sample/SampleViewController.swift b/Sample/SampleViewController.swift index fdf7d74..9cad56b 100644 --- a/Sample/SampleViewController.swift +++ b/Sample/SampleViewController.swift @@ -94,7 +94,7 @@ private extension SampleViewController { struct FullScreen: RowPresentable { let string: String = "Full Screen" - let rowVC: PanModalPresentable.LayoutType = FullScreenViewController() + let rowVC: PanModalPresentable.LayoutType = FullScreenNavController() } struct Alert: RowPresentable { diff --git a/Sample/View Controllers/Full Screen/FullScreenNavController.swift b/Sample/View Controllers/Full Screen/FullScreenNavController.swift new file mode 100644 index 0000000..83e5727 --- /dev/null +++ b/Sample/View Controllers/Full Screen/FullScreenNavController.swift @@ -0,0 +1,65 @@ +// +// FullScreenNavController.swift +// PanModalDemo +// +// Created by Stephen Sowole on 5/2/19. +// Copyright © 2019 Detail. All rights reserved. +// + +import UIKit + +class FullScreenNavController: UINavigationController { + + override func viewDidLoad() { + super.viewDidLoad() + pushViewController(FullScreenViewController(), animated: false) + } +} + +extension FullScreenNavController: PanModalPresentable { + + var panScrollable: UIScrollView? { + return nil + } + + var topOffset: CGFloat { + return 0.0 + } + + var springDamping: CGFloat { + return 1.0 + } + + var shouldRoundTopCorners: Bool { + return false + } + + var showDragIndicator: Bool { + return false + } +} + +private class FullScreenViewController: UIViewController { + + let textLabel: UILabel = { + let label = UILabel() + label.text = "Drag downwards to dismiss" + label.font = UIFont(name: "Lato-Bold", size: 17) + label.translatesAutoresizingMaskIntoConstraints = false + return label + }() + + override func viewDidLoad() { + super.viewDidLoad() + title = "Full Screen" + view.backgroundColor = .white + setupConstraints() + } + + private func setupConstraints() { + view.addSubview(textLabel) + textLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true + textLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true + } + +} diff --git a/Sample/View Controllers/Full Screen/FullScreenViewController.swift b/Sample/View Controllers/Full Screen/FullScreenViewController.swift deleted file mode 100644 index ad8b0fd..0000000 --- a/Sample/View Controllers/Full Screen/FullScreenViewController.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// FullScreenViewController.swift -// PanModalDemo -// -// Created by Stephen Sowole on 5/2/19. -// Copyright © 2019 Detail. All rights reserved. -// - -import UIKit - -class FullScreenViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - view.backgroundColor = .white - } -} - -extension FullScreenViewController: PanModalPresentable { - - var panScrollable: UIScrollView? { - return nil - } - - var topOffset: CGFloat { - return 0.0 - } - - var springDamping: CGFloat { - return 1.0 - } - - var shouldRoundTopCorners: Bool { - return false - } - - var showDragIndicator: Bool { - return false - } -}