Skip to content

Hotfix 0.2.1 #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 15, 2023
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