Skip to content
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

Add dummy awakeFromNib dummy method #195

Merged
merged 1 commit into from
Aug 31, 2023
Merged

Conversation

gcasa
Copy link
Member

@gcasa gcasa commented Aug 31, 2023

This adds a dummy method for NSView so that subclasses can call awakeFromNib. I have run into production code which does this and does not fail on macOS. I also have a test which I will add to git and reference here.

@gcasa
Copy link
Member Author

gcasa commented Aug 31, 2023

@gcasa gcasa requested a review from fredkiefer August 31, 2023 19:58
@fredkiefer
Copy link
Member

This new method will result in a lot of useless calls but if Apple has it, we will need it too.

@fredkiefer fredkiefer merged commit 629d065 into master Aug 31, 2023
4 checks passed
@fredkiefer fredkiefer deleted the NSView_awakeFromNib_issue194 branch August 31, 2023 21:41
@gcasa
Copy link
Member Author

gcasa commented Sep 1, 2023

@fredkiefer One additional suggestion I have on this... even though it is merged.

You lament that we are "making a lot of useless calls" yet it appears to me that in order to avoid making said useless calls we are invoking "respondsToSelector" in an if and THEN making the call instead of just assuming the method is always there, so, for the calls that don't have the method we are doing an "if" AND a respondsToSelector call anyway and for those that do have it we are doing both of those AND the call anyway.

I am wondering if it is more or less expensive to simply assume its presence rather than check for it, but that's a discussion for another time.

@fredkiefer
Copy link
Member

Sounds like a valid solution to me. In that case we should move this method to NSObject.

@gcasa
Copy link
Member Author

gcasa commented Sep 2, 2023

I would guess/bet that this method is implemented on NSObject via a category in AppKit. I am going to do some research today to see if that's the case.

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

Successfully merging this pull request may close these issues.

2 participants