-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Extract SFHFKeychainUtils to dedicated Swift package #24192
Conversation
All those Swift files compile without importing UIKit because `SFHFKeychainUtils.h` did that for them and they got access to it via the bridging header. Next, we'll move SFHFKeychainUtils into the modules, and UIKit will no longer be available through it. Side note: UIKit should not have been available via SFHFKeychainUtils in the first place. On top of that, SFHFKeychainUtils does not need UIKit either.
Generated by 🚫 Danger |
#import <UIKit/UIKit.h> | ||
#import <Foundation/Foundation.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIKit was not needed.
Also, you'll see many import UIKit
in the diff. All those Swift files compiled before without importing UIKit because SFHFKeychainUtils.h
did that for them and they got access to it via the bridging header.
I find it quite interesting that a seldom visited file had such an impact on unrelate files that did not even use its functionality.
@@ -1,6 +1,7 @@ | |||
// TODO: Port to yet to create SFHFKeychainUtils test package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for feedback on this PR. Then, if the setup remains the same, I'll open an issue to remember to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr24192-45a98f7 | |
Version | 25.8 | |
Bundle ID | org.wordpress.alpha | |
Commit | 45a98f7 | |
App Center Build | WPiOS - One-Offs #11643 |
We need it in a dedicated package because the Objective-C implementation does not use ARC. Therefore, we need to use the `-fno-objc-arc` compiler setting. But such a setting should be applied sparingly so instead of blanket using it in an existing Objective-C package like WordPressSharedObjC, we use it surgically just for this file.
95580ff
to
45a98f7
Compare
|
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr24192-45a98f7 | |
Version | 25.8 | |
Bundle ID | com.jetpack.alpha | |
Commit | 45a98f7 | |
App Center Build | jetpack-installable-builds #10672 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very nice.
And I need this too for my work on app extensions – merging 🙇 |
Problem Some of the files we are moving out of the WordPress/Jetpack target to WordPressData access the keychain via
SFHFKeychainUtils
, but we cannot move out the utility itself because other files unrelated to storage use it, too.Solution Move
SFHFKeychainUtils
to a shared location.Given the object is implemented in Objective-C, I initially tried to move it to WordPressSharedObjC, but this failed because
SFHFKeychainUtils
is so old it does not use ARC.I decided not to go down the rabbit hole of rewriting it to support ARC (maybe I should have) and instead moved it into a dedicated package with the
-fno-objc-arc
compiler flag.Testing
I run the WordPress app on my iPhone and smoke tested it checking all tabs.
Part of #24165