From cf47cde0aaca64ddaa400ecfbde425415582e6b5 Mon Sep 17 00:00:00 2001 From: Bryan Keller Date: Thu, 14 Mar 2024 22:10:05 -0700 Subject: [PATCH 1/2] =?UTF-8?q?Revert=20"Expose=20configuration=20to=20ign?= =?UTF-8?q?ore=20EpoxySwiftUIHostingController=20safe=20are=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e46fab4024d4e8e0d5754d7add8be1ccb94390f3. --- .../BarModel/SwiftUI.View+BarModel.swift | 8 ++------ .../SwiftUI/EpoxySwiftUIHostingView.swift | 15 ++------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/Sources/EpoxyBars/BarModel/SwiftUI.View+BarModel.swift b/Sources/EpoxyBars/BarModel/SwiftUI.View+BarModel.swift index 26537e2b..61ca7376 100644 --- a/Sources/EpoxyBars/BarModel/SwiftUI.View+BarModel.swift +++ b/Sources/EpoxyBars/BarModel/SwiftUI.View+BarModel.swift @@ -11,12 +11,9 @@ extension View { /// - dataID: An ID that uniquely identifies this item relative to other items in the /// same collection. /// - reuseBehavior: The reuse behavior of the `EpoxySwiftUIHostingView`. - /// - ignoreSafeArea: Whether or not the underlying `EpoxySwiftUIHostingController` will ignore its safe area. - /// Only set this to `false` when installing this BarModel using `BarContainerInsetBehavior.barHeightContentInset` or `BarContainerInsetBehavior.none`. public func barModel( dataID: AnyHashable? = nil, - reuseBehavior: SwiftUIHostingViewReuseBehavior = .reusable, - ignoreSafeArea: Bool = true) + reuseBehavior: SwiftUIHostingViewReuseBehavior = .reusable) -> BarModel> { EpoxySwiftUIHostingView.barModel( @@ -24,8 +21,7 @@ extension View { content: .init(rootView: self, dataID: dataID), style: .init( reuseBehavior: reuseBehavior, - initialContent: .init(rootView: self, dataID: dataID), - ignoreSafeArea: ignoreSafeArea)) + initialContent: .init(rootView: self, dataID: dataID))) .linkDisplayLifecycle() } } diff --git a/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift b/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift index 481a52d2..b2ce33ad 100644 --- a/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift +++ b/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift @@ -67,7 +67,7 @@ public final class EpoxySwiftUIHostingView: UIView, EpoxyableVie epoxyContent = EpoxyHostingContent(rootView: style.initialContent.rootView) viewController = EpoxySwiftUIHostingController( rootView: .init(content: epoxyContent, environment: epoxyEnvironment), - ignoreSafeArea: style.ignoreSafeArea) + ignoreSafeArea: true) dataID = style.initialContent.dataID ?? DefaultDataID.noneProvided as AnyHashable @@ -97,24 +97,13 @@ public final class EpoxySwiftUIHostingView: UIView, EpoxyableVie // MARK: Public public struct Style: Hashable { - - // MARK: Lifecycle - - public init( - reuseBehavior: SwiftUIHostingViewReuseBehavior, - initialContent: Content, - ignoreSafeArea: Bool = true) - { + public init(reuseBehavior: SwiftUIHostingViewReuseBehavior, initialContent: Content) { self.reuseBehavior = reuseBehavior self.initialContent = initialContent - self.ignoreSafeArea = ignoreSafeArea } - // MARK: Public - public var reuseBehavior: SwiftUIHostingViewReuseBehavior public var initialContent: Content - public var ignoreSafeArea: Bool public static func == (lhs: Style, rhs: Style) -> Bool { lhs.reuseBehavior == rhs.reuseBehavior From 42683fb74c4d66b9b41f7850821da6722b726258 Mon Sep 17 00:00:00 2001 From: Bryan Keller Date: Fri, 15 Mar 2024 10:43:57 -0700 Subject: [PATCH 2/2] Remove old comment --- Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift b/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift index b2ce33ad..d7ab1933 100644 --- a/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift +++ b/Sources/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift @@ -343,12 +343,8 @@ public final class EpoxySwiftUIHostingView: UIView, EpoxyableVie viewController.view.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ viewController.view.leadingAnchor.constraint(equalTo: leadingAnchor), - // Pining the hosting view controller to layoutMarginsGuide ensures the content respects the top safe area - // when installed inside a `TopBarContainer` viewController.view.topAnchor.constraint(equalTo: topAnchor), viewController.view.trailingAnchor.constraint(equalTo: trailingAnchor), - // Pining the hosting view controller to layoutMarginsGuide ensures the content respects the bottom safe area - // when installed inside a `BottomBarContainer` viewController.view.bottomAnchor.constraint(equalTo: bottomAnchor), ])