Skip to content

View Controller Introspection is Inconsistent #166

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

Closed
rzulkoski opened this issue Sep 23, 2022 · 2 comments
Closed

View Controller Introspection is Inconsistent #166

rzulkoski opened this issue Sep 23, 2022 · 2 comments

Comments

@rzulkoski
Copy link
Contributor

I have determined there is a timing issue present when attempting to introspect a UIKit view controller.

Sometimes when UIKitIntrospectionViewController. updateUIViewController(_:context:) is called the view controller's parent is not set yet and its view is not in the view hierarchy yet (hasn't been added to the window). This means that there are times when the customization never gets applied because the selector failed to find the target.

UIKitIntrospectionView works around this issue by applying the customizations as part of a moveToWindowHandler set on the IntrospectionUIView.

I was able to fix this issue by updating UIKitIntrospectionViewController to also use its view's moveToWindowHandler when apply customizations. In addition, I updated both UIKitIntrospectionView and UIKitIntrospectionViewController to set their handlers up front in their respective makeUIView(Controller) methods rather than delaying it until updateUIView(Controller) is called.

See pull request #165

@rzulkoski
Copy link
Contributor Author

This has now been fixed. Thanks for getting this across the finish line @davdroman!

@davdroman
Copy link
Collaborator

@rzulkoski no worries! I'll do some CI maintenance over the weekend and tag a new release by Monday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants