Skip to content

Commit

Permalink
Hotfix 0.2.1 (#196)
Browse files Browse the repository at this point in the history
This actually fixes the regression in #194. My bad for not checking
better. A good area of improvement for automated tests.
  • Loading branch information
davdroman authored Feb 15, 2023
1 parent 7a00ea9 commit 9a860a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
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

0 comments on commit 9a860a0

Please sign in to comment.