From 6a426ebce6e2ef0db4629cf7dbf95937528359b5 Mon Sep 17 00:00:00 2001 From: ulmentflam Date: Thu, 20 Aug 2020 10:27:49 -0400 Subject: [PATCH 1/4] a fix for the issue with auto layout feedback loops on ios 14 that supports pannel mode. via issue #390 --- PulleyLib/PulleyViewController.swift | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/PulleyLib/PulleyViewController.swift b/PulleyLib/PulleyViewController.swift index 1ee47c4..46c52cc 100644 --- a/PulleyLib/PulleyViewController.swift +++ b/PulleyLib/PulleyViewController.swift @@ -598,13 +598,20 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel /// The currently rendered display mode for Pulley. This will match displayMode unless you have it set to 'automatic'. This will provide the 'actual' display mode (never automatic). public fileprivate(set) var currentDisplayMode: PulleyDisplayMode = .automatic { didSet { - if self.isViewLoaded - { - self.view.setNeedsLayout() + + if oldValue == currentDisplayMode { + if self.isViewLoaded { + self.view.layoutIfNeeded() + } } if oldValue != currentDisplayMode { + if self.isViewLoaded + { + self.view.setNeedsLayout() + } + delegate?.drawerDisplayModeDidChange?(drawer: self) (drawerContentViewController as? PulleyDrawerViewControllerDelegate)?.drawerDisplayModeDidChange?(drawer: self) (primaryContentContainer as? PulleyPrimaryContentControllerDelegate)?.drawerDisplayModeDidChange?(drawer: self) From d747587cf15d7cf1dd6a15197ed62b27b100ea22 Mon Sep 17 00:00:00 2001 From: ulmentflam Date: Thu, 20 Aug 2020 12:32:42 -0400 Subject: [PATCH 2/4] After more testing, it does not need to call set layoutIfNeeded when the value doesn't change --- PulleyLib/PulleyViewController.swift | 6 ------ 1 file changed, 6 deletions(-) diff --git a/PulleyLib/PulleyViewController.swift b/PulleyLib/PulleyViewController.swift index 46c52cc..e2d26e0 100644 --- a/PulleyLib/PulleyViewController.swift +++ b/PulleyLib/PulleyViewController.swift @@ -598,12 +598,6 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel /// The currently rendered display mode for Pulley. This will match displayMode unless you have it set to 'automatic'. This will provide the 'actual' display mode (never automatic). public fileprivate(set) var currentDisplayMode: PulleyDisplayMode = .automatic { didSet { - - if oldValue == currentDisplayMode { - if self.isViewLoaded { - self.view.layoutIfNeeded() - } - } if oldValue != currentDisplayMode { From abfdb026031912711307b34d77e2359f5919c226 Mon Sep 17 00:00:00 2001 From: ulmentflam Date: Wed, 16 Sep 2020 12:34:42 -0400 Subject: [PATCH 3/4] Prepareing for release, still waiting on feedback for issues via #390 --- Pulley.podspec | 2 +- Pulley.xcodeproj/project.pbxproj | 4 +++- .../xcshareddata/xcschemes/Pulley.xcscheme | 6 +----- .../xcshareddata/xcschemes/PulleyDemo.xcscheme | 10 +++------- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Pulley.podspec b/Pulley.podspec index 77787ce..2d685b7 100644 --- a/Pulley.podspec +++ b/Pulley.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'Pulley' - s.version = '2.8.1' + s.version = '2.8.2' s.summary = 'A library to imitate the iOS 10 Maps UI.' # This description is used to generate tags and improve search results. diff --git a/Pulley.xcodeproj/project.pbxproj b/Pulley.xcodeproj/project.pbxproj index c329a6b..7c2d0fd 100644 --- a/Pulley.xcodeproj/project.pbxproj +++ b/Pulley.xcodeproj/project.pbxproj @@ -213,7 +213,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1200; ORGANIZATIONNAME = 52inc; TargetAttributes = { 355DBF121E40EA4300671CDD = { @@ -392,6 +392,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -449,6 +450,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; diff --git a/Pulley.xcodeproj/xcshareddata/xcschemes/Pulley.xcscheme b/Pulley.xcodeproj/xcshareddata/xcschemes/Pulley.xcscheme index e0481fb..a8a36da 100644 --- a/Pulley.xcodeproj/xcshareddata/xcschemes/Pulley.xcscheme +++ b/Pulley.xcodeproj/xcshareddata/xcschemes/Pulley.xcscheme @@ -1,6 +1,6 @@ - - - - - - - - + + - - Date: Fri, 18 Sep 2020 10:55:55 -0400 Subject: [PATCH 4/4] Stoping the drawer view from layout in the drawerMaskingPath function stops the auto-layout loop in iOS 14 --- .../xcschemes/PulleyDemo.xcscheme | 6 +++ Pulley/Main.storyboard | 43 ++++++++++++------- PulleyLib/PulleyViewController.swift | 5 ++- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/Pulley.xcodeproj/xcshareddata/xcschemes/PulleyDemo.xcscheme b/Pulley.xcodeproj/xcshareddata/xcschemes/PulleyDemo.xcscheme index 39042e4..d34a845 100644 --- a/Pulley.xcodeproj/xcshareddata/xcschemes/PulleyDemo.xcscheme +++ b/Pulley.xcodeproj/xcshareddata/xcschemes/PulleyDemo.xcscheme @@ -59,6 +59,12 @@ ReferencedContainer = "container:Pulley.xcodeproj"> + + + + - + - + + - @@ -30,6 +30,7 @@ + @@ -41,7 +42,6 @@ - @@ -61,7 +61,7 @@ - + @@ -95,7 +95,7 @@ - + @@ -107,7 +107,7 @@ + @@ -132,7 +133,6 @@ - @@ -153,9 +153,9 @@ - - + + - @@ -228,16 +228,16 @@ @@ -278,6 +278,7 @@ + @@ -292,7 +293,6 @@ - @@ -312,4 +312,15 @@ + + + + + + + + + + + diff --git a/PulleyLib/PulleyViewController.swift b/PulleyLib/PulleyViewController.swift index e2d26e0..d8462d9 100644 --- a/PulleyLib/PulleyViewController.swift +++ b/PulleyLib/PulleyViewController.swift @@ -996,7 +996,10 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel user of this library), then the corners parameter will be ignored. */ private func drawerMaskingPath(byRoundingCorners corners: UIRectCorner) -> UIBezierPath { - drawerContentViewController.view.layoutIfNeeded() + // Only layout the drawer content view if the position is not closed. If the position is closed this view is not visable and does not need to be layout for the masking path. This is the root of iOS 14 auto layout feedback loop. + if drawerPosition != .closed { + drawerContentViewController.view.layoutIfNeeded() + } let path: UIBezierPath if let customPath = (drawerContentViewController.view.layer.mask as? CAShapeLayer)?.path {