Skip to content

Commit

Permalink
Merge pull request #397 from 52inc/xcode12
Browse files Browse the repository at this point in the history
Xcode12 Auto-layout Feedback Loop Fixes
  • Loading branch information
ulmentflam committed Sep 30, 2020
2 parents a34e0ed + d84be49 commit 3fc83e7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Pulley.podspec
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'Pulley'
s.version = '2.8.3'
s.version = '2.8.4'
s.summary = 'A library to imitate the iOS 10 Maps UI.'

# This description is used to generate tags and improve search results.
Expand Down
Expand Up @@ -62,7 +62,7 @@
<CommandLineArguments>
<CommandLineArgument
argument = "-UIViewLayoutFeedbackLoopDebuggingThreshold 100"
isEnabled = "NO">
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
Expand Down
39 changes: 27 additions & 12 deletions PulleyLib/PulleyViewController.swift
Expand Up @@ -328,7 +328,7 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
/// The inset from the top safe area when the drawer is fully open. This property is only for the 'drawer' displayMode. Use panelInsets to control the top/bottom/left/right insets for the panel.
@IBInspectable public var drawerTopInset: CGFloat = 20.0 {
didSet {
if self.isViewLoaded
if oldValue != drawerTopInset, self.isViewLoaded
{
self.view.setNeedsLayout()
}
Expand All @@ -338,7 +338,7 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
/// This replaces the previous panelInsetLeft and panelInsetTop properties. Depending on what corner placement is being used, different values from this struct will apply. For example, 'topLeft' corner placement will utilize the .top, .left, and .bottom inset properties and it will ignore the .right property (use panelWidth property to specify width)
@IBInspectable public var panelInsets: UIEdgeInsets = UIEdgeInsets(top: 10.0, left: 10.0, bottom: 10.0, right: 10.0) {
didSet {
if self.isViewLoaded
if oldValue != panelInsets, self.isViewLoaded
{
self.view.setNeedsLayout()
}
Expand All @@ -348,7 +348,7 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
/// The width of the panel in panel displayMode
@IBInspectable public var panelWidth: CGFloat = 325.0 {
didSet {
if self.isViewLoaded
if oldValue != panelWidth, self.isViewLoaded
{
self.view.setNeedsLayout()
}
Expand All @@ -362,7 +362,9 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
didSet {
if self.isViewLoaded
{
self.view.setNeedsLayout()
if oldValue != drawerCornerRadius {
self.view.setNeedsLayout()
}
drawerBackgroundVisualEffectView?.layer.cornerRadius = drawerCornerRadius
}
}
Expand All @@ -374,7 +376,10 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
if self.isViewLoaded
{
drawerShadowView.layer.shadowOpacity = shadowOpacity
self.view.setNeedsLayout()
if oldValue != shadowOpacity
{
self.view.setNeedsLayout()
}
}
}
}
Expand All @@ -385,19 +390,27 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
if self.isViewLoaded
{
drawerShadowView.layer.shadowRadius = shadowRadius
self.view.setNeedsLayout()
if oldValue != shadowRadius
{
self.view.setNeedsLayout()
}
}

}
}

/// The offset of the drawer shadow.
@IBInspectable public var shadowOffset = CGSize(width: 0.0, height: -3.0) {
didSet {
if self.isViewLoaded {
drawerShadowView.layer.shadowOffset = shadowOffset
self.view.setNeedsLayout()
}
}
if self.isViewLoaded
{
drawerShadowView.layer.shadowOffset = shadowOffset
if oldValue != shadowOffset
{
self.view.setNeedsLayout()
}
}
}
}

/// The opaque color of the background dimming view.
Expand Down Expand Up @@ -576,7 +589,9 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel
return
}

self.view.setNeedsLayout()
if oldValue != supportedPositions {
self.view.setNeedsLayout()
}

if supportedPositions.contains(drawerPosition)
{
Expand Down

0 comments on commit 3fc83e7

Please sign in to comment.