Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Sources/Public/ItemViews/SwiftUIWrapperView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class SwiftUIWrapperView<Content: View>: UIView {

public init(contentAndID: ContentAndID) {
self.contentAndID = contentAndID
hostingController = UIHostingController(rootView: AnyView(contentAndID.content))
hostingController = UIHostingController(rootView: contentAndID.content)
hostingController._disableSafeArea = true

super.init(frame: .zero)
Expand Down Expand Up @@ -59,7 +59,9 @@ public final class SwiftUIWrapperView<Content: View>: UIView {
public override var isHidden: Bool {
didSet {
if isHidden {
hostingController.rootView = AnyView(EmptyView())
hostingControllerView.removeFromSuperview()
} else {
addSubview(hostingControllerView)
}
}
}
Expand Down Expand Up @@ -99,14 +101,14 @@ public final class SwiftUIWrapperView<Content: View>: UIView {

fileprivate var contentAndID: ContentAndID {
didSet {
hostingController.rootView = AnyView(contentAndID.content)
hostingController.rootView = contentAndID.content
configureGestureRecognizers()
}
}

// MARK: Private

private let hostingController: UIHostingController<AnyView>
private let hostingController: UIHostingController<Content>

private var hostingControllerView: UIView {
hostingController.view
Expand Down