From 9a860a08250fe9355db157d437d403df915a0246 Mon Sep 17 00:00:00 2001 From: David Roman <2538074+davdroman@users.noreply.github.com> Date: Wed, 15 Feb 2023 20:53:21 +0000 Subject: [PATCH] Hotfix 0.2.1 (#196) This actually fixes the regression in #194. My bad for not checking better. A good area of improvement for automated tests. --- Introspect/UIKitIntrospectionView.swift | 11 +++++++---- Introspect/UIKitIntrospectionViewController.swift | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Introspect/UIKitIntrospectionView.swift b/Introspect/UIKitIntrospectionView.swift index 236abae9..9d9765fe 100644 --- a/Introspect/UIKitIntrospectionView.swift +++ b/Introspect/UIKitIntrospectionView.swift @@ -67,15 +67,18 @@ public struct UIKitIntrospectionView: 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 ) { - 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 diff --git a/Introspect/UIKitIntrospectionViewController.swift b/Introspect/UIKitIntrospectionViewController.swift index 4d8f1d34..a0e20d7b 100644 --- a/Introspect/UIKitIntrospectionViewController.swift +++ b/Introspect/UIKitIntrospectionViewController.swift @@ -59,7 +59,10 @@ public struct UIKitIntrospectionViewController ) { - (viewController.view as? IntrospectionUIView)?.moveToWindowHandler?() + guard let targetView = self.selector(viewController) else { + return + } + self.customize(targetView) } /// Avoid memory leaks.