Skip to content

Commit 9a860a0

Browse files
authored
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.
1 parent 7a00ea9 commit 9a860a0

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Introspect/UIKitIntrospectionView.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,18 @@ public struct UIKitIntrospectionView<TargetViewType: UIView>: UIViewRepresentabl
6767
/// `makeUIView`, so we need to call the handler again to allow re-customization
6868
/// based on the newest state.
6969
public func updateUIView(
70-
_ uiView: IntrospectionUIView,
70+
_ view: IntrospectionUIView,
7171
context: UIViewRepresentableContext<UIKitIntrospectionView>
7272
) {
73-
uiView.moveToWindowHandler?()
73+
guard let targetView = self.selector(view) else {
74+
return
75+
}
76+
self.customize(targetView)
7477
}
7578

7679
/// Avoid memory leaks.
77-
public static func dismantleUIView(_ uiView: IntrospectionUIView, coordinator: ()) {
78-
uiView.moveToWindowHandler = nil
80+
public static func dismantleUIView(_ view: IntrospectionUIView, coordinator: ()) {
81+
view.moveToWindowHandler = nil
7982
}
8083
}
8184
#endif

Introspect/UIKitIntrospectionViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ public struct UIKitIntrospectionViewController<TargetViewControllerType: UIViewC
5959
_ viewController: IntrospectionUIViewController,
6060
context: UIViewControllerRepresentableContext<UIKitIntrospectionViewController>
6161
) {
62-
(viewController.view as? IntrospectionUIView)?.moveToWindowHandler?()
62+
guard let targetView = self.selector(viewController) else {
63+
return
64+
}
65+
self.customize(targetView)
6366
}
6467

6568
/// Avoid memory leaks.

0 commit comments

Comments
 (0)