Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 7 additions & 4 deletions Introspect/UIKitIntrospectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,18 @@ public struct UIKitIntrospectionView<TargetViewType: UIView>: UIViewRepresentabl
/// `makeUIView`, so we need to call the handler again to allow re-customization
/// based on the newest state.
public func updateUIView(
_ uiView: IntrospectionUIView,
_ view: IntrospectionUIView,
context: UIViewRepresentableContext<UIKitIntrospectionView>
) {
uiView.moveToWindowHandler?()
guard let targetView = self.selector(view) else {
return
}
self.customize(targetView)
}

/// Avoid memory leaks.
public static func dismantleUIView(_ uiView: IntrospectionUIView, coordinator: ()) {
uiView.moveToWindowHandler = nil
public static func dismantleUIView(_ view: IntrospectionUIView, coordinator: ()) {
view.moveToWindowHandler = nil
}
}
#endif
5 changes: 4 additions & 1 deletion Introspect/UIKitIntrospectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ public struct UIKitIntrospectionViewController<TargetViewControllerType: UIViewC
_ viewController: IntrospectionUIViewController,
context: UIViewControllerRepresentableContext<UIKitIntrospectionViewController>
) {
(viewController.view as? IntrospectionUIView)?.moveToWindowHandler?()
guard let targetView = self.selector(viewController) else {
return
}
self.customize(targetView)
}

/// Avoid memory leaks.
Expand Down