Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b151fd268 | |||
| 7bdf702703 | |||
| 0d1381d941 |
@@ -11,13 +11,6 @@
|
||||
F445CA8921AED92600184254 /* Controller.swift in Sources */ = {isa = PBXBuildFile; fileRef = F445CA8821AED92600184254 /* Controller.swift */; };
|
||||
F445CA8E21AED92700184254 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F445CA8D21AED92700184254 /* Assets.xcassets */; };
|
||||
F445CA9121AED92700184254 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F445CA8F21AED92700184254 /* LaunchScreen.storyboard */; };
|
||||
F4552722221C009D00F40446 /* SPStorkViewControllerExtenshion.swift in Sources */ = {isa = PBXBuildFile; fileRef = F455267A221C009D00F40446 /* SPStorkViewControllerExtenshion.swift */; };
|
||||
F4552723221C009D00F40446 /* SPStorkTransitioningDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F455267B221C009D00F40446 /* SPStorkTransitioningDelegate.swift */; };
|
||||
F4552724221C009D00F40446 /* SPStorkPresentingAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F455267C221C009D00F40446 /* SPStorkPresentingAnimationController.swift */; };
|
||||
F4552725221C009D00F40446 /* SPStorkPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F455267D221C009D00F40446 /* SPStorkPresentationController.swift */; };
|
||||
F4552726221C009D00F40446 /* SPStorkController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F455267E221C009D00F40446 /* SPStorkController.swift */; };
|
||||
F4552727221C009D00F40446 /* SPStorkIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F455267F221C009D00F40446 /* SPStorkIndicatorView.swift */; };
|
||||
F4552728221C009D00F40446 /* SPStorkDismissingAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4552680221C009D00F40446 /* SPStorkDismissingAnimationController.swift */; };
|
||||
F4552729221C009D00F40446 /* SPVibration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4552683221C009D00F40446 /* SPVibration.swift */; };
|
||||
F455272A221C009D00F40446 /* SPPromoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4552687221C009D00F40446 /* SPPromoTableViewCell.swift */; };
|
||||
F455272B221C009D00F40446 /* SPFormButtonTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4552689221C009D00F40446 /* SPFormButtonTableViewCell.swift */; };
|
||||
@@ -138,6 +131,13 @@
|
||||
F455279E221C009E00F40446 /* SPShare.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4552721221C009D00F40446 /* SPShare.swift */; };
|
||||
F459D75B21C3AB9A00798524 /* ModalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F459D75A21C3AB9A00798524 /* ModalViewController.swift */; };
|
||||
F459D75D21C3ABBD00798524 /* ModalTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F459D75C21C3ABBD00798524 /* ModalTableViewController.swift */; };
|
||||
F4A9E9D4221C6DBA0031492C /* SPStorkViewControllerExtenshion.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A9E9CD221C6DBA0031492C /* SPStorkViewControllerExtenshion.swift */; };
|
||||
F4A9E9D5221C6DBA0031492C /* SPStorkTransitioningDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A9E9CE221C6DBA0031492C /* SPStorkTransitioningDelegate.swift */; };
|
||||
F4A9E9D6221C6DBA0031492C /* SPStorkPresentingAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A9E9CF221C6DBA0031492C /* SPStorkPresentingAnimationController.swift */; };
|
||||
F4A9E9D7221C6DBA0031492C /* SPStorkPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A9E9D0221C6DBA0031492C /* SPStorkPresentationController.swift */; };
|
||||
F4A9E9D8221C6DBA0031492C /* SPStorkController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A9E9D1221C6DBA0031492C /* SPStorkController.swift */; };
|
||||
F4A9E9D9221C6DBA0031492C /* SPStorkIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A9E9D2221C6DBA0031492C /* SPStorkIndicatorView.swift */; };
|
||||
F4A9E9DA221C6DBA0031492C /* SPStorkDismissingAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A9E9D3221C6DBA0031492C /* SPStorkDismissingAnimationController.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -147,13 +147,6 @@
|
||||
F445CA8D21AED92700184254 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
F445CA9021AED92700184254 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
F445CA9221AED92700184254 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
F455267A221C009D00F40446 /* SPStorkViewControllerExtenshion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkViewControllerExtenshion.swift; sourceTree = "<group>"; };
|
||||
F455267B221C009D00F40446 /* SPStorkTransitioningDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkTransitioningDelegate.swift; sourceTree = "<group>"; };
|
||||
F455267C221C009D00F40446 /* SPStorkPresentingAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkPresentingAnimationController.swift; sourceTree = "<group>"; };
|
||||
F455267D221C009D00F40446 /* SPStorkPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkPresentationController.swift; sourceTree = "<group>"; };
|
||||
F455267E221C009D00F40446 /* SPStorkController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkController.swift; sourceTree = "<group>"; };
|
||||
F455267F221C009D00F40446 /* SPStorkIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkIndicatorView.swift; sourceTree = "<group>"; };
|
||||
F4552680221C009D00F40446 /* SPStorkDismissingAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkDismissingAnimationController.swift; sourceTree = "<group>"; };
|
||||
F4552683221C009D00F40446 /* SPVibration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPVibration.swift; sourceTree = "<group>"; };
|
||||
F4552687221C009D00F40446 /* SPPromoTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPPromoTableViewCell.swift; sourceTree = "<group>"; };
|
||||
F4552689221C009D00F40446 /* SPFormButtonTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPFormButtonTableViewCell.swift; sourceTree = "<group>"; };
|
||||
@@ -274,6 +267,13 @@
|
||||
F4552721221C009D00F40446 /* SPShare.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPShare.swift; sourceTree = "<group>"; };
|
||||
F459D75A21C3AB9A00798524 /* ModalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalViewController.swift; sourceTree = "<group>"; };
|
||||
F459D75C21C3ABBD00798524 /* ModalTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalTableViewController.swift; sourceTree = "<group>"; };
|
||||
F4A9E9CD221C6DBA0031492C /* SPStorkViewControllerExtenshion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkViewControllerExtenshion.swift; sourceTree = "<group>"; };
|
||||
F4A9E9CE221C6DBA0031492C /* SPStorkTransitioningDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkTransitioningDelegate.swift; sourceTree = "<group>"; };
|
||||
F4A9E9CF221C6DBA0031492C /* SPStorkPresentingAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkPresentingAnimationController.swift; sourceTree = "<group>"; };
|
||||
F4A9E9D0221C6DBA0031492C /* SPStorkPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkPresentationController.swift; sourceTree = "<group>"; };
|
||||
F4A9E9D1221C6DBA0031492C /* SPStorkController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkController.swift; sourceTree = "<group>"; };
|
||||
F4A9E9D2221C6DBA0031492C /* SPStorkIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkIndicatorView.swift; sourceTree = "<group>"; };
|
||||
F4A9E9D3221C6DBA0031492C /* SPStorkDismissingAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPStorkDismissingAnimationController.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -322,26 +322,12 @@
|
||||
F445CA9821AED98500184254 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F4A9E9CC221C6DBA0031492C /* SPStorkController */,
|
||||
F4552681221C009D00F40446 /* SparrowKit */,
|
||||
F4552679221C009D00F40446 /* SPStorkController */,
|
||||
);
|
||||
path = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F4552679221C009D00F40446 /* SPStorkController */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F455267A221C009D00F40446 /* SPStorkViewControllerExtenshion.swift */,
|
||||
F455267B221C009D00F40446 /* SPStorkTransitioningDelegate.swift */,
|
||||
F455267C221C009D00F40446 /* SPStorkPresentingAnimationController.swift */,
|
||||
F455267D221C009D00F40446 /* SPStorkPresentationController.swift */,
|
||||
F455267E221C009D00F40446 /* SPStorkController.swift */,
|
||||
F455267F221C009D00F40446 /* SPStorkIndicatorView.swift */,
|
||||
F4552680221C009D00F40446 /* SPStorkDismissingAnimationController.swift */,
|
||||
);
|
||||
path = SPStorkController;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F4552681221C009D00F40446 /* SparrowKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -803,6 +789,20 @@
|
||||
path = Share;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F4A9E9CC221C6DBA0031492C /* SPStorkController */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F4A9E9CD221C6DBA0031492C /* SPStorkViewControllerExtenshion.swift */,
|
||||
F4A9E9CE221C6DBA0031492C /* SPStorkTransitioningDelegate.swift */,
|
||||
F4A9E9CF221C6DBA0031492C /* SPStorkPresentingAnimationController.swift */,
|
||||
F4A9E9D0221C6DBA0031492C /* SPStorkPresentationController.swift */,
|
||||
F4A9E9D1221C6DBA0031492C /* SPStorkController.swift */,
|
||||
F4A9E9D2221C6DBA0031492C /* SPStorkIndicatorView.swift */,
|
||||
F4A9E9D3221C6DBA0031492C /* SPStorkDismissingAnimationController.swift */,
|
||||
);
|
||||
path = SPStorkController;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -875,7 +875,6 @@
|
||||
files = (
|
||||
F455276B221C009E00F40446 /* SPArrayExtension.swift in Sources */,
|
||||
F455276F221C009E00F40446 /* SPStrideableExtension.swift in Sources */,
|
||||
F4552726221C009D00F40446 /* SPStorkController.swift in Sources */,
|
||||
F4552729221C009D00F40446 /* SPVibration.swift in Sources */,
|
||||
F4552760221C009E00F40446 /* SPCollectionView.swift in Sources */,
|
||||
F4552744221C009E00F40446 /* SPFakeBarView.swift in Sources */,
|
||||
@@ -883,9 +882,11 @@
|
||||
F455277E221C009E00F40446 /* SPAppBadge.swift in Sources */,
|
||||
F4552756221C009E00F40446 /* SPGolubevIconView.swift in Sources */,
|
||||
F4552752221C009E00F40446 /* SPCenterLabelsView.swift in Sources */,
|
||||
F4A9E9D4221C6DBA0031492C /* SPStorkViewControllerExtenshion.swift in Sources */,
|
||||
F4552776221C009E00F40446 /* SPUILabelExtenshion.swift in Sources */,
|
||||
F445CA8921AED92600184254 /* Controller.swift in Sources */,
|
||||
F4552775221C009E00F40446 /* SPCGRectExtension.swift in Sources */,
|
||||
F4A9E9D8221C6DBA0031492C /* SPStorkController.swift in Sources */,
|
||||
F4552779221C009E00F40446 /* SPUIImageViewExtenshion.swift in Sources */,
|
||||
F455278B221C009E00F40446 /* SPAnimationAlpha.swift in Sources */,
|
||||
F455273A221C009E00F40446 /* SPAppleMusicSectionButtonsView.swift in Sources */,
|
||||
@@ -899,7 +900,9 @@
|
||||
F455273F221C009E00F40446 /* SPButton.swift in Sources */,
|
||||
F4552759221C009E00F40446 /* SPTableController.swift in Sources */,
|
||||
F4552786221C009E00F40446 /* SPLayout.swift in Sources */,
|
||||
F4A9E9DA221C6DBA0031492C /* SPStorkDismissingAnimationController.swift in Sources */,
|
||||
F455279E221C009E00F40446 /* SPShare.swift in Sources */,
|
||||
F4A9E9D5221C6DBA0031492C /* SPStorkTransitioningDelegate.swift in Sources */,
|
||||
F4552774221C009E00F40446 /* SPUINavigationControllerExtenshion.swift in Sources */,
|
||||
F455275B221C009E00F40446 /* SPController.swift in Sources */,
|
||||
F455279A221C009E00F40446 /* SPGolubevGolubevIconPack.swift in Sources */,
|
||||
@@ -911,7 +914,6 @@
|
||||
F4552749221C009E00F40446 /* SPDownloadingUIImageView.swift in Sources */,
|
||||
F4552751221C009E00F40446 /* SPLabel.swift in Sources */,
|
||||
F455276A221C009E00F40446 /* SPUIViewExtenshion.swift in Sources */,
|
||||
F4552723221C009D00F40446 /* SPStorkTransitioningDelegate.swift in Sources */,
|
||||
F4552794221C009E00F40446 /* SPAudio.swift in Sources */,
|
||||
F455279C221C009E00F40446 /* SPRandom.swift in Sources */,
|
||||
F4552778221C009E00F40446 /* SPCGSizeExtenshion.swift in Sources */,
|
||||
@@ -923,6 +925,7 @@
|
||||
F455276D221C009E00F40446 /* SPUIViewControllerExtenshion.swift in Sources */,
|
||||
F4552736221C009D00F40446 /* SPTableViewCell.swift in Sources */,
|
||||
F459D75D21C3ABBD00798524 /* ModalTableViewController.swift in Sources */,
|
||||
F4A9E9D7221C6DBA0031492C /* SPStorkPresentationController.swift in Sources */,
|
||||
F4552798221C009E00F40446 /* SPCodeSystemIconPack.swift in Sources */,
|
||||
F4552769221C009E00F40446 /* SPUITableView.swift in Sources */,
|
||||
F455277A221C009E00F40446 /* SPUIColorExtension.swift in Sources */,
|
||||
@@ -935,7 +938,6 @@
|
||||
F455274C221C009E00F40446 /* SPSeparatorView.swift in Sources */,
|
||||
F455273C221C009E00F40446 /* SPSystemIconButton.swift in Sources */,
|
||||
F4552761221C009E00F40446 /* SPPageCollectionView.swift in Sources */,
|
||||
F4552728221C009D00F40446 /* SPStorkDismissingAnimationController.swift in Sources */,
|
||||
F4552767221C009E00F40446 /* SPUIFontExtenshion.swift in Sources */,
|
||||
F4552766221C009E00F40446 /* SPUITextFieldExtenshion.swift in Sources */,
|
||||
F4552772221C009E00F40446 /* SPTextFieldExtenshion.swift in Sources */,
|
||||
@@ -945,7 +947,6 @@
|
||||
F455272C221C009D00F40446 /* SPFormMailTableViewCell.swift in Sources */,
|
||||
F4552773221C009E00F40446 /* SPUITabBarControllerExtenshion.swift in Sources */,
|
||||
F4552737221C009E00F40446 /* SPTableView.swift in Sources */,
|
||||
F4552724221C009D00F40446 /* SPStorkPresentingAnimationController.swift in Sources */,
|
||||
F455278D221C009E00F40446 /* SPDownloader.swift in Sources */,
|
||||
F4552777221C009E00F40446 /* SPDateExtenshion.swift in Sources */,
|
||||
F4552782221C009E00F40446 /* SPLocalAuthentication.swift in Sources */,
|
||||
@@ -954,17 +955,16 @@
|
||||
F455275A221C009E00F40446 /* SPStatusBarManagerController.swift in Sources */,
|
||||
F4552792221C009E00F40446 /* SPInstagram.swift in Sources */,
|
||||
F455278F221C009E00F40446 /* SPTwitter.swift in Sources */,
|
||||
F4552725221C009D00F40446 /* SPStorkPresentationController.swift in Sources */,
|
||||
F455274B221C009E00F40446 /* SPGradientView.swift in Sources */,
|
||||
F4552747221C009E00F40446 /* SPTextView.swift in Sources */,
|
||||
F455275C221C009E00F40446 /* SPCollectionViewCell.swift in Sources */,
|
||||
F4A9E9D6221C6DBA0031492C /* SPStorkPresentingAnimationController.swift in Sources */,
|
||||
F4552764221C009E00F40446 /* SPUIAlertControllerExtenshion.swift in Sources */,
|
||||
F4552787221C009E00F40446 /* SPShadow.swift in Sources */,
|
||||
F4552740221C009E00F40446 /* SPAppStoreActionButton.swift in Sources */,
|
||||
F455275E221C009E00F40446 /* SPCollectionViewLayout.swift in Sources */,
|
||||
F4552780221C009E00F40446 /* SPNativeColors.swift in Sources */,
|
||||
F455272E221C009D00F40446 /* SPFormTextFiledTableViewCell.swift in Sources */,
|
||||
F4552722221C009D00F40446 /* SPStorkViewControllerExtenshion.swift in Sources */,
|
||||
F445CA8721AED92600184254 /* AppDelegate.swift in Sources */,
|
||||
F4552738221C009E00F40446 /* SPPlayCircleButton.swift in Sources */,
|
||||
F4552754221C009E00F40446 /* SPSocialIconView.swift in Sources */,
|
||||
@@ -973,6 +973,7 @@
|
||||
F459D75B21C3AB9A00798524 /* ModalViewController.swift in Sources */,
|
||||
F4552771221C009E00F40446 /* SPUICollectionViewExtenshion.swift in Sources */,
|
||||
F455277D221C009E00F40446 /* SPApp.swift in Sources */,
|
||||
F4A9E9D9221C6DBA0031492C /* SPStorkIndicatorView.swift in Sources */,
|
||||
F455274E221C009E00F40446 /* SPBlurView.swift in Sources */,
|
||||
F4552784221C009E00F40446 /* SPLocalNotification.swift in Sources */,
|
||||
F4552757221C009E00F40446 /* SPProposeController.swift in Sources */,
|
||||
@@ -981,7 +982,6 @@
|
||||
F4552734221C009D00F40446 /* SPProposeTableViewCell.swift in Sources */,
|
||||
F4552793221C009E00F40446 /* SPWhatsApp.swift in Sources */,
|
||||
F4552788221C009E00F40446 /* SPShadowDeep.swift in Sources */,
|
||||
F4552727221C009D00F40446 /* SPStorkIndicatorView.swift in Sources */,
|
||||
F4552763221C009E00F40446 /* SPLocale.swift in Sources */,
|
||||
F4552789221C009E00F40446 /* SPAnimationUpward.swift in Sources */,
|
||||
F4552795221C009E00F40446 /* SPAudioPlayer.swift in Sources */,
|
||||
|
||||
BIN
Binary file not shown.
Regular → Executable
+14
-4
@@ -25,21 +25,31 @@ public struct SPStorkController {
|
||||
|
||||
static public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
if let controller = self.controller(for: scrollView) {
|
||||
if let presentationController = controller.presentationController as? SPStorkPresentationController,
|
||||
presentationController.swipeToDismissEnabled {
|
||||
if let presentationController = controller.presentationController as? SPStorkPresentationController {
|
||||
let translation = -(scrollView.contentOffset.y + scrollView.contentInset.top)
|
||||
if translation >= 0 {
|
||||
|
||||
if controller.isBeingPresented { return }
|
||||
|
||||
scrollView.subviews.forEach {
|
||||
$0.transform = CGAffineTransform(translationX: 0, y: -translation)
|
||||
}
|
||||
|
||||
presentationController.setIndicator(style: scrollView.isDragging ? .line : .arrow)
|
||||
|
||||
if let pan = presentationController.pan,
|
||||
pan.state == .possible, pan.translation(in: controller.view).y <= 0 {
|
||||
if translation >= presentationController.translateForDismiss * 0.65 {
|
||||
if !scrollView.isDragging {
|
||||
presentationController.presentedViewController.dismiss(animated: true, completion: nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if presentationController.pan?.state != UIGestureRecognizer.State.changed {
|
||||
presentationController.scrollViewDidScroll(translation)
|
||||
}
|
||||
|
||||
} else {
|
||||
presentationController.setIndicator(style: .arrow)
|
||||
presentationController.scrollViewDidScroll(0)
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+5
-8
@@ -294,7 +294,7 @@ extension SPStorkPresentationController {
|
||||
self.workGester = false
|
||||
let translation = gestureRecognizer.translation(in: presentedView).y
|
||||
if translation >= self.translateForDismiss {
|
||||
presentedViewController.dismiss(animated: true, completion: nil)
|
||||
self.presentedViewController.dismiss(animated: true, completion: nil)
|
||||
} else {
|
||||
self.indicatorView.style = .arrow
|
||||
UIView.animate(
|
||||
@@ -325,6 +325,10 @@ extension SPStorkPresentationController {
|
||||
self.updateSnapshot()
|
||||
}
|
||||
|
||||
func setIndicator(style: SPStorkIndicatorView.Style) {
|
||||
self.indicatorView.style = style
|
||||
}
|
||||
|
||||
private func updatePresentedViewForTranslation(inVerticalDirection translation: CGFloat) {
|
||||
if self.startDismissing { return }
|
||||
|
||||
@@ -353,13 +357,6 @@ extension SPStorkPresentationController {
|
||||
|
||||
extension SPStorkPresentationController {
|
||||
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if swipeToDismissEnabled, let scrollView = otherGestureRecognizer.view as? UIScrollView{
|
||||
return scrollView.contentOffset.y <= 0
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override func containerViewWillLayoutSubviews() {
|
||||
super.containerViewWillLayoutSubviews()
|
||||
guard let containerView = containerView else { return }
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
@@ -166,7 +166,7 @@ pod 'SparrowKit'
|
||||
|
||||
### Working with UIScrollView
|
||||
|
||||
If you use `UIScrollView` (or UITableView & UICollectionView) on your controller, I recommend making it more interactive. When scrolling reaches the top position, the controller will interactively drag down, simulating a closing animation. To do this, set the delegate and in the function `scrollViewDidScroll` call:
|
||||
If you use `UIScrollView` (or UITableView & UICollectionView) on your controller, I recommend making it more interactive. When scrolling reaches the top position, the controller will interactively drag down, simulating a closing animation. Also available close controller by drag down on `UIScrollView`. To do this, set the delegate and in the function `scrollViewDidScroll` call:
|
||||
|
||||
```swift
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SPStorkController"
|
||||
s.version = "1.4.7"
|
||||
s.version = "1.5"
|
||||
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 }
|
||||
|
||||
Regular → Executable
+15
-5
@@ -25,21 +25,31 @@ public struct SPStorkController {
|
||||
|
||||
static public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
if let controller = self.controller(for: scrollView) {
|
||||
if let presentationController = controller.presentationController as? SPStorkPresentationController,
|
||||
presentationController.swipeToDismissEnabled {
|
||||
if let presentationController = controller.presentationController as? SPStorkPresentationController {
|
||||
let translation = -(scrollView.contentOffset.y + scrollView.contentInset.top)
|
||||
if translation >= 0 {
|
||||
|
||||
if controller.isBeingPresented { return }
|
||||
|
||||
scrollView.subviews.forEach {
|
||||
$0.transform = CGAffineTransform(translationX: 0, y: -translation)
|
||||
}
|
||||
|
||||
presentationController.setIndicator(style: scrollView.isTracking ? .line : .arrow)
|
||||
|
||||
if let pan = presentationController.pan,
|
||||
pan.state == .possible, pan.translation(in: controller.view).y <= 0 {
|
||||
presentationController.scrollViewDidScroll(translation)
|
||||
if translation >= presentationController.translateForDismiss * 0.4 {
|
||||
if !scrollView.isTracking && !scrollView.isDragging {
|
||||
presentationController.presentedViewController.dismiss(animated: true, completion: nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if presentationController.pan?.state != UIGestureRecognizer.State.changed {
|
||||
presentationController.scrollViewDidScroll(translation * 2)
|
||||
}
|
||||
|
||||
} else {
|
||||
presentationController.setIndicator(style: .arrow)
|
||||
presentationController.scrollViewDidScroll(0)
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+10
-12
@@ -28,7 +28,7 @@ class SPStorkPresentationController: UIPresentationController, UIGestureRecogniz
|
||||
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 translateForDismiss: CGFloat = 240
|
||||
var translateForDismiss: CGFloat = 200
|
||||
|
||||
var transitioningDelegate: SPStorkTransitioningDelegate?
|
||||
|
||||
@@ -294,7 +294,7 @@ extension SPStorkPresentationController {
|
||||
self.workGester = false
|
||||
let translation = gestureRecognizer.translation(in: presentedView).y
|
||||
if translation >= self.translateForDismiss {
|
||||
presentedViewController.dismiss(animated: true, completion: nil)
|
||||
self.presentedViewController.dismiss(animated: true, completion: nil)
|
||||
} else {
|
||||
self.indicatorView.style = .arrow
|
||||
UIView.animate(
|
||||
@@ -325,6 +325,10 @@ extension SPStorkPresentationController {
|
||||
self.updateSnapshot()
|
||||
}
|
||||
|
||||
func setIndicator(style: SPStorkIndicatorView.Style) {
|
||||
self.indicatorView.style = style
|
||||
}
|
||||
|
||||
private func updatePresentedViewForTranslation(inVerticalDirection translation: CGFloat) {
|
||||
if self.startDismissing { return }
|
||||
|
||||
@@ -344,22 +348,16 @@ extension SPStorkPresentationController {
|
||||
|
||||
self.presentedView?.transform = CGAffineTransform(translationX: 0, y: translationForModal)
|
||||
|
||||
let factor = 1 + (translationForModal / 6000)
|
||||
self.snapshotView?.transform = CGAffineTransform.init(scaleX: factor, y: factor)
|
||||
self.gradeView.alpha = self.alpha - ((factor - 1) * 15)
|
||||
let scaleFactor = 1 + (translationForModal / 5000)
|
||||
self.snapshotView?.transform = CGAffineTransform.init(scaleX: scaleFactor, y: scaleFactor)
|
||||
let gradeFactor = 1 + (translationForModal / 7000)
|
||||
self.gradeView.alpha = self.alpha - ((gradeFactor - 1) * 15)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension SPStorkPresentationController {
|
||||
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if swipeToDismissEnabled, let scrollView = otherGestureRecognizer.view as? UIScrollView{
|
||||
return scrollView.contentOffset.y <= 0
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override func containerViewWillLayoutSubviews() {
|
||||
super.containerViewWillLayoutSubviews()
|
||||
guard let containerView = containerView else { return }
|
||||
|
||||
Regular → Executable
Regular → Executable
+1
-1
@@ -28,7 +28,7 @@ public final class SPStorkTransitioningDelegate: NSObject, UIViewControllerTrans
|
||||
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 var translateForDismiss: CGFloat = 240
|
||||
public var translateForDismiss: CGFloat = 200
|
||||
|
||||
public func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
|
||||
let controller = SPStorkPresentationController(presentedViewController: presented, presenting: presenting)
|
||||
|
||||
Regular → Executable
Reference in New Issue
Block a user