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

fix: crash on iOS 15 in SwiftySelfAwareHelper #105

Merged
merged 1 commit into from
Nov 1, 2021

Conversation

Ashton-W
Copy link
Contributor

@Ashton-W Ashton-W commented Aug 10, 2021

Replace CustomSelfAwareHelper with direct call to Wormholy class. CustomSelfAwareHelper crashes on iOS 15 in optimised builds in the "harmlessFunction" which is using objc runtime to iterate through all classes and checking for a protocol conformance. There was also a performance concern with this method.

Since Wormholy only has one class that conforms to SelfAware and this is not public API we are providing to consumers of the library, we don't need a generic solution. It has been replaced with a single direct function call.

Removed WormholyStarterEngine objc class. constructor attribute static function inside actually had no association with the class. Renamed to wormholy_constructor.
wormholy_constructor calls Wormholy class directly, instead of indirectly through runtime check of SelfAware protocol.
Removed SelfAware protocol.
Removed CustomSelfAwareHelper struct.
Removed StarterEngine class.

Fixes #103
Fixes #98
Fixes #96

Replace `CustomSelfAwareHelper ` with direct call to `Wormholy` class. `CustomSelfAwareHelper` crashes on iOS 15 in optimised builds in the "harmlessFunction" which is using objc runtime to iterate through *all* classes and checking for a protocol conformance. There was also a performance concern with this method.

Since Wormholy only has one class that conforms to `SelfAware` and this is not public API we are providing to consumers of the library, we don't need a generic solution. It has been replaced with a single direct function call.

Removed `WormholyStarterEngine` objc class. constructor attribute static function inside actually had no association with the class. Moved to `wormholy_constructor`.
`wormholy_constructor` calls `Wormholy` class directly, instead of indirectly through runtime of `SelfAware`.
Removed `SelfAware` protocol.
Removed `CustomSelfAwareHelper` struct.
Removed `StarterEngine` class.
@nexron171
Copy link

@pmusolino please take in account

@pmusolino pmusolino self-requested a review November 1, 2021 18:14
@pmusolino pmusolino self-assigned this Nov 1, 2021
@pmusolino pmusolino added bug Something isn't working enhancement New feature or request labels Nov 1, 2021
Copy link
Owner

@pmusolino pmusolino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you so much @Ashton-W for this great improvement and for fixing the crashes. I'm going to merge it right now.

@pmusolino pmusolino merged commit 35cc25f into pmusolino:master Nov 1, 2021
@Ashton-W Ashton-W deleted the fix/iOS-15 branch November 2, 2021 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crash on iOS 15.0.0 Crash at startup Performance degratation in CustomSelfAwareHelper.harmlessFunction()
3 participants