diff --git a/Example/stork-controller.xcodeproj/project.pbxproj b/Example/stork-controller.xcodeproj/project.pbxproj index 64683cf..dfe0b2b 100644 --- a/Example/stork-controller.xcodeproj/project.pbxproj +++ b/Example/stork-controller.xcodeproj/project.pbxproj @@ -131,12 +131,12 @@ F4891A4C21FC738800E65424 /* SPRandom.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48919CC21FC738800E65424 /* SPRandom.swift */; }; F4891A4D21FC738800E65424 /* SPDelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48919CE21FC738800E65424 /* SPDelay.swift */; }; F4891A4E21FC738800E65424 /* SPShare.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48919D021FC738800E65424 /* SPShare.swift */; }; - F4891A4F21FC738800E65424 /* SPStorkTransitioningDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48919D321FC738800E65424 /* SPStorkTransitioningDelegate.swift */; }; - F4891A5021FC738800E65424 /* SPStorkPresentingAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48919D421FC738800E65424 /* SPStorkPresentingAnimationController.swift */; }; - F4891A5121FC738800E65424 /* SPStorkPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48919D521FC738800E65424 /* SPStorkPresentationController.swift */; }; - F4891A5221FC738800E65424 /* SPStorkController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48919D621FC738800E65424 /* SPStorkController.swift */; }; - F4891A5321FC738800E65424 /* SPStorkIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48919D721FC738800E65424 /* SPStorkIndicatorView.swift */; }; - F4891A5421FC738800E65424 /* SPStorkDismissingAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48919D821FC738800E65424 /* SPStorkDismissingAnimationController.swift */; }; + F4B9E13B2203734E00E87087 /* SPStorkTransitioningDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4B9E1352203734E00E87087 /* SPStorkTransitioningDelegate.swift */; }; + F4B9E13C2203734E00E87087 /* SPStorkPresentingAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4B9E1362203734E00E87087 /* SPStorkPresentingAnimationController.swift */; }; + F4B9E13D2203734E00E87087 /* SPStorkPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4B9E1372203734E00E87087 /* SPStorkPresentationController.swift */; }; + F4B9E13E2203734E00E87087 /* SPStorkController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4B9E1382203734E00E87087 /* SPStorkController.swift */; }; + F4B9E13F2203734E00E87087 /* SPStorkIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4B9E1392203734E00E87087 /* SPStorkIndicatorView.swift */; }; + F4B9E1402203734E00E87087 /* SPStorkDismissingAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4B9E13A2203734E00E87087 /* SPStorkDismissingAnimationController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -266,12 +266,12 @@ F48919CC21FC738800E65424 /* SPRandom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPRandom.swift; sourceTree = ""; }; F48919CE21FC738800E65424 /* SPDelay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPDelay.swift; sourceTree = ""; }; F48919D021FC738800E65424 /* SPShare.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPShare.swift; sourceTree = ""; }; - F48919D321FC738800E65424 /* SPStorkTransitioningDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkTransitioningDelegate.swift; sourceTree = ""; }; - F48919D421FC738800E65424 /* SPStorkPresentingAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkPresentingAnimationController.swift; sourceTree = ""; }; - F48919D521FC738800E65424 /* SPStorkPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkPresentationController.swift; sourceTree = ""; }; - F48919D621FC738800E65424 /* SPStorkController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkController.swift; sourceTree = ""; }; - F48919D721FC738800E65424 /* SPStorkIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkIndicatorView.swift; sourceTree = ""; }; - F48919D821FC738800E65424 /* SPStorkDismissingAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkDismissingAnimationController.swift; sourceTree = ""; }; + F4B9E1352203734E00E87087 /* SPStorkTransitioningDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkTransitioningDelegate.swift; sourceTree = ""; }; + F4B9E1362203734E00E87087 /* SPStorkPresentingAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkPresentingAnimationController.swift; sourceTree = ""; }; + F4B9E1372203734E00E87087 /* SPStorkPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkPresentationController.swift; sourceTree = ""; }; + F4B9E1382203734E00E87087 /* SPStorkController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkController.swift; sourceTree = ""; }; + F4B9E1392203734E00E87087 /* SPStorkIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkIndicatorView.swift; sourceTree = ""; }; + F4B9E13A2203734E00E87087 /* SPStorkDismissingAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkDismissingAnimationController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -320,8 +320,8 @@ F445CA9821AED98500184254 /* Frameworks */ = { isa = PBXGroup; children = ( + F4B9E1342203734E00E87087 /* SPStorkController */, F489192F21FC738800E65424 /* SparrowKit */, - F48919D221FC738800E65424 /* SPStorkController */, ); path = Frameworks; sourceTree = ""; @@ -803,15 +803,15 @@ path = Badge; sourceTree = ""; }; - F48919D221FC738800E65424 /* SPStorkController */ = { + F4B9E1342203734E00E87087 /* SPStorkController */ = { isa = PBXGroup; children = ( - F48919D321FC738800E65424 /* SPStorkTransitioningDelegate.swift */, - F48919D421FC738800E65424 /* SPStorkPresentingAnimationController.swift */, - F48919D521FC738800E65424 /* SPStorkPresentationController.swift */, - F48919D621FC738800E65424 /* SPStorkController.swift */, - F48919D721FC738800E65424 /* SPStorkIndicatorView.swift */, - F48919D821FC738800E65424 /* SPStorkDismissingAnimationController.swift */, + F4B9E1352203734E00E87087 /* SPStorkTransitioningDelegate.swift */, + F4B9E1362203734E00E87087 /* SPStorkPresentingAnimationController.swift */, + F4B9E1372203734E00E87087 /* SPStorkPresentationController.swift */, + F4B9E1382203734E00E87087 /* SPStorkController.swift */, + F4B9E1392203734E00E87087 /* SPStorkIndicatorView.swift */, + F4B9E13A2203734E00E87087 /* SPStorkDismissingAnimationController.swift */, ); path = SPStorkController; sourceTree = ""; @@ -911,7 +911,7 @@ F4891A0421FC738800E65424 /* SPFormTextTableViewCell.swift in Sources */, F4891A3521FC738800E65424 /* SPMail.swift in Sources */, F48919DA21FC738800E65424 /* SPPlayCircleButton.swift in Sources */, - F4891A5421FC738800E65424 /* SPStorkDismissingAnimationController.swift in Sources */, + F4B9E1402203734E00E87087 /* SPStorkDismissingAnimationController.swift in Sources */, F4891A1D21FC738800E65424 /* SPUIViewControllerExtenshion.swift in Sources */, F4891A0921FC738800E65424 /* SPTableViewCell.swift in Sources */, F48919FC21FC738800E65424 /* SPEmptyProposeView.swift in Sources */, @@ -941,7 +941,7 @@ F4891A2521FC738800E65424 /* SPCGRectExtension.swift in Sources */, F4891A4E21FC738800E65424 /* SPShare.swift in Sources */, F48919F021FC738800E65424 /* SPFakeBarView.swift in Sources */, - F4891A5221FC738800E65424 /* SPStorkController.swift in Sources */, + F4B9E13E2203734E00E87087 /* SPStorkController.swift in Sources */, F4891A1C21FC738800E65424 /* SPUserDefaultsExtenshion.swift in Sources */, F48919E121FC738800E65424 /* SPButton.swift in Sources */, F48919FA21FC738800E65424 /* SPEmptyProposeLabel.swift in Sources */, @@ -974,7 +974,7 @@ F48919EE21FC738800E65424 /* SPMengTransformCollectionView.swift in Sources */, F4891A4421FC738800E65424 /* SPAudio.swift in Sources */, F4891A3721FC738800E65424 /* SPShadow.swift in Sources */, - F4891A5021FC738800E65424 /* SPStorkPresentingAnimationController.swift in Sources */, + F4B9E13C2203734E00E87087 /* SPStorkPresentingAnimationController.swift in Sources */, F4891A2B21FC738800E65424 /* SPUIButtonExtenshion.swift in Sources */, F48919F121FC738800E65424 /* SPEmptyTitlesView.swift in Sources */, F4891A2721FC738800E65424 /* SPDateExtenshion.swift in Sources */, @@ -998,15 +998,15 @@ F4891A1721FC738800E65424 /* SPUIFontExtenshion.swift in Sources */, F4891A3821FC738800E65424 /* SPShadowDeep.swift in Sources */, F48919FF21FC738800E65424 /* SPFormMailTableViewCell.swift in Sources */, - F4891A5321FC738800E65424 /* SPStorkIndicatorView.swift in Sources */, + F4B9E13F2203734E00E87087 /* SPStorkIndicatorView.swift in Sources */, F4891A1B21FC738800E65424 /* SPArrayExtension.swift in Sources */, F48919FE21FC738800E65424 /* SPFormButtonTableViewCell.swift in Sources */, - F4891A5121FC738800E65424 /* SPStorkPresentationController.swift in Sources */, + F4B9E13D2203734E00E87087 /* SPStorkPresentationController.swift in Sources */, F4891A0C21FC738800E65424 /* SPSystemIconView.swift in Sources */, F4891A4021FC738800E65424 /* SPViber.swift in Sources */, F4891A1121FC738800E65424 /* SPSpotlight.swift in Sources */, F4891A1821FC738800E65424 /* SPUIImageExtension.swift in Sources */, - F4891A4F21FC738800E65424 /* SPStorkTransitioningDelegate.swift in Sources */, + F4B9E13B2203734E00E87087 /* SPStorkTransitioningDelegate.swift in Sources */, F4891A1621FC738800E65424 /* SPUITextFieldExtenshion.swift in Sources */, F4891A1F21FC738800E65424 /* SPStrideableExtension.swift in Sources */, F48919EB21FC738800E65424 /* SPCollectionViewLayout.swift in Sources */, diff --git a/Example/stork-controller.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate b/Example/stork-controller.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate index ce4addb..3b4b35e 100644 Binary files a/Example/stork-controller.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate and b/Example/stork-controller.xcodeproj/project.xcworkspace/xcuserdata/ivanvorobei.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Example/stork-controller/Frameworks/SPStorkController/SPStorkIndicatorView.swift b/Example/stork-controller/Frameworks/SPStorkController/SPStorkIndicatorView.swift index ee503fe..81fbdfc 100644 --- a/Example/stork-controller/Frameworks/SPStorkController/SPStorkIndicatorView.swift +++ b/Example/stork-controller/Frameworks/SPStorkController/SPStorkIndicatorView.swift @@ -42,6 +42,13 @@ class SPStorkIndicatorView: UIView { } } + var color: UIColor = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) { + didSet { + self.leftView.backgroundColor = self.color + self.rightView.backgroundColor = self.color + } + } + private var leftView: UIView = UIView() private var rightView: UIView = UIView() @@ -50,8 +57,7 @@ class SPStorkIndicatorView: UIView { self.backgroundColor = UIColor.clear self.addSubview(self.leftView) self.addSubview(self.rightView) - self.leftView.backgroundColor = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) - self.rightView.backgroundColor = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) + self.color = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) } required init?(coder aDecoder: NSCoder) { diff --git a/Example/stork-controller/Frameworks/SPStorkController/SPStorkPresentationController.swift b/Example/stork-controller/Frameworks/SPStorkController/SPStorkPresentationController.swift index 80411fc..08ae706 100644 --- a/Example/stork-controller/Frameworks/SPStorkController/SPStorkPresentationController.swift +++ b/Example/stork-controller/Frameworks/SPStorkController/SPStorkPresentationController.swift @@ -26,6 +26,7 @@ class SPStorkPresentationController: UIPresentationController, UIGestureRecogniz var isSwipeToDismissEnabled: Bool = true var isTapAroundToDismissEnabled: Bool = true var showIndicator: Bool = true + var indicatorColor: UIColor = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) var customHeight: CGFloat? = nil var transitioningDelegate: SPStorkTransitioningDelegate? @@ -82,6 +83,7 @@ class SPStorkPresentationController: UIPresentationController, UIGestureRecogniz guard let containerView = self.containerView, let presentedView = self.presentedView, let window = containerView.window else { return } if self.showIndicator { + self.indicatorView.color = self.indicatorColor presentedView.addSubview(self.indicatorView) } self.updateLayoutIndicator() @@ -268,6 +270,8 @@ extension SPStorkPresentationController { self.workGester = true self.indicatorView.style = .line self.presentingViewController.view.layer.removeAllAnimations() + self.presentingViewController.view.endEditing(true) + self.presentedViewController.view.endEditing(true) gestureRecognizer.setTranslation(CGPoint(x: 0, y: 0), in: containerView) case .changed: self.workGester = true diff --git a/Example/stork-controller/Frameworks/SPStorkController/SPStorkTransitioningDelegate.swift b/Example/stork-controller/Frameworks/SPStorkController/SPStorkTransitioningDelegate.swift index 5c378bc..51a68ef 100644 --- a/Example/stork-controller/Frameworks/SPStorkController/SPStorkTransitioningDelegate.swift +++ b/Example/stork-controller/Frameworks/SPStorkController/SPStorkTransitioningDelegate.swift @@ -26,6 +26,7 @@ public final class SPStorkTransitioningDelegate: NSObject, UIViewControllerTrans public var isSwipeToDismissEnabled: Bool = true public var isTapAroundToDismissEnabled: Bool = true public var showIndicator: Bool = true + public var indicatorColor: UIColor = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) public var customHeight: CGFloat? = nil public func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? { @@ -33,6 +34,7 @@ public final class SPStorkTransitioningDelegate: NSObject, UIViewControllerTrans controller.isSwipeToDismissEnabled = self.isSwipeToDismissEnabled controller.isTapAroundToDismissEnabled = self.isTapAroundToDismissEnabled controller.showIndicator = self.showIndicator + controller.indicatorColor = self.indicatorColor controller.customHeight = self.customHeight controller.transitioningDelegate = self return controller diff --git a/README.md b/README.md index 756ff8c..d7be131 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,11 @@ transitionDelegate.isTapAroundToDismissEnabled = true transitionDelegate.showIndicator = true ``` +- Parameter `indicatorColor` for customize color of arrow. Default is `gray`: +```swift +transitionDelegate.indicatorColor = UIColor.white +``` + - Parameter `customHeight` sets custom height for modal controller. Default is `nil`: ```swift transitionDelegate.customHeight = 350 diff --git a/SPStorkController.podspec b/SPStorkController.podspec index e6e16fc..bebe02f 100644 --- a/SPStorkController.podspec +++ b/SPStorkController.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SPStorkController" - s.version = "1.2.1" + s.version = "1.2.2" s.summary = "Modal controller as mail or Apple music application" s.homepage = "https://github.com/IvanVorobei/SPStorkController" s.source = { :git => "https://github.com/IvanVorobei/SPStorkController.git", :tag => s.version } diff --git a/Source/SPStorkController/SPStorkIndicatorView.swift b/Source/SPStorkController/SPStorkIndicatorView.swift index ee503fe..81fbdfc 100644 --- a/Source/SPStorkController/SPStorkIndicatorView.swift +++ b/Source/SPStorkController/SPStorkIndicatorView.swift @@ -42,6 +42,13 @@ class SPStorkIndicatorView: UIView { } } + var color: UIColor = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) { + didSet { + self.leftView.backgroundColor = self.color + self.rightView.backgroundColor = self.color + } + } + private var leftView: UIView = UIView() private var rightView: UIView = UIView() @@ -50,8 +57,7 @@ class SPStorkIndicatorView: UIView { self.backgroundColor = UIColor.clear self.addSubview(self.leftView) self.addSubview(self.rightView) - self.leftView.backgroundColor = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) - self.rightView.backgroundColor = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) + self.color = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) } required init?(coder aDecoder: NSCoder) { diff --git a/Source/SPStorkController/SPStorkPresentationController.swift b/Source/SPStorkController/SPStorkPresentationController.swift index 80411fc..08ae706 100644 --- a/Source/SPStorkController/SPStorkPresentationController.swift +++ b/Source/SPStorkController/SPStorkPresentationController.swift @@ -26,6 +26,7 @@ class SPStorkPresentationController: UIPresentationController, UIGestureRecogniz var isSwipeToDismissEnabled: Bool = true var isTapAroundToDismissEnabled: Bool = true var showIndicator: Bool = true + var indicatorColor: UIColor = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) var customHeight: CGFloat? = nil var transitioningDelegate: SPStorkTransitioningDelegate? @@ -82,6 +83,7 @@ class SPStorkPresentationController: UIPresentationController, UIGestureRecogniz guard let containerView = self.containerView, let presentedView = self.presentedView, let window = containerView.window else { return } if self.showIndicator { + self.indicatorView.color = self.indicatorColor presentedView.addSubview(self.indicatorView) } self.updateLayoutIndicator() @@ -268,6 +270,8 @@ extension SPStorkPresentationController { self.workGester = true self.indicatorView.style = .line self.presentingViewController.view.layer.removeAllAnimations() + self.presentingViewController.view.endEditing(true) + self.presentedViewController.view.endEditing(true) gestureRecognizer.setTranslation(CGPoint(x: 0, y: 0), in: containerView) case .changed: self.workGester = true diff --git a/Source/SPStorkController/SPStorkTransitioningDelegate.swift b/Source/SPStorkController/SPStorkTransitioningDelegate.swift index 5c378bc..51a68ef 100644 --- a/Source/SPStorkController/SPStorkTransitioningDelegate.swift +++ b/Source/SPStorkController/SPStorkTransitioningDelegate.swift @@ -26,6 +26,7 @@ public final class SPStorkTransitioningDelegate: NSObject, UIViewControllerTrans public var isSwipeToDismissEnabled: Bool = true public var isTapAroundToDismissEnabled: Bool = true public var showIndicator: Bool = true + public var indicatorColor: UIColor = UIColor.init(red: 202/255, green: 201/255, blue: 207/255, alpha: 1) public var customHeight: CGFloat? = nil public func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? { @@ -33,6 +34,7 @@ public final class SPStorkTransitioningDelegate: NSObject, UIViewControllerTrans controller.isSwipeToDismissEnabled = self.isSwipeToDismissEnabled controller.isTapAroundToDismissEnabled = self.isTapAroundToDismissEnabled controller.showIndicator = self.showIndicator + controller.indicatorColor = self.indicatorColor controller.customHeight = self.customHeight controller.transitioningDelegate = self return controller