From d469caad69541d007166f9f84367b0488515feaf Mon Sep 17 00:00:00 2001 From: Shin Yamamoto Date: Sat, 24 Nov 2018 10:54:30 +0900 Subject: [PATCH] Fix unexpected assertion failure --- Framework/Sources/FloatingPanelController.swift | 1 + Framework/Sources/FloatingPanelLayout.swift | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Framework/Sources/FloatingPanelController.swift b/Framework/Sources/FloatingPanelController.swift index 2b782c4..dd5a9fe 100644 --- a/Framework/Sources/FloatingPanelController.swift +++ b/Framework/Sources/FloatingPanelController.swift @@ -219,6 +219,7 @@ public class FloatingPanelController: UIViewController, UIScrollViewDelegate, UI private func updateLayout(for traitCollection: UITraitCollection) { floatingPanel.layoutAdapter.layout = fetchLayout(for: traitCollection) + floatingPanel.layoutAdapter.checkLayoutConsistance() guard let parent = parent else { return } diff --git a/Framework/Sources/FloatingPanelLayout.swift b/Framework/Sources/FloatingPanelLayout.swift index 91464d9..b0244b4 100644 --- a/Framework/Sources/FloatingPanelLayout.swift +++ b/Framework/Sources/FloatingPanelLayout.swift @@ -110,11 +110,7 @@ class FloatingPanelLayoutAdapter { private weak var surfaceView: FloatingPanelSurfaceView! private weak var backdropView: FloatingPanelBackdropView! - var layout: FloatingPanelLayout { - didSet { - checkLayoutConsistance() - } - } + var layout: FloatingPanelLayout var safeAreaInsets: UIEdgeInsets = .zero { didSet { @@ -304,7 +300,7 @@ class FloatingPanelLayoutAdapter { assert(layout.insetFor(position: pos) != nil, "Undefined an inset for a pos(\(pos))") } - guard !(layout is FloatingPanelIntrinsicLayout) else { return } + if halfInset > 0 { assert(halfInset > tipInset, "Invalid half and tip insets") }