-
Notifications
You must be signed in to change notification settings - Fork 16
SPM Prep - Isolate API version enum and convert to modern Objective-C #778
Conversation
| success: @escaping (() -> Void), | ||
| failure: @escaping ((Error) -> Void)) { | ||
| let path = self.path(forEndpoint: "me/social-login/connect", withVersion: ._1_1) | ||
| let path = self.path(forEndpoint: "me/social-login/connect", with: ._1_1) |
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.
The compiler changed this, which was a bit annoying because it made the diff quite noisy.
I guess the compiler is happy with just "with" when the type on the other side is "strong", i.e. a typedef NS_ENUM that converts neatly to enum in Swift.
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.
You can avoid this name change by adding a NS_SWIFT_NAME(path(forEndpoint:withVersion:)) to the function in the ObjC header.
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.
Nice! Much better diff, thanks for the tip @crazytonyli
I think the Swift API is better this way, too. with: ._1_1 was not as clear as withVersion: ._1_1.
c437048 to
25efc1f
Compare
25efc1f to
071a046
Compare
This should help with isolating the value so that we can further extract the path logic in the Swift implementation.
071a046 to
ee3d90b
Compare
|
Force pushed to resolve merge conflict without having to add merge commit. |
Description
The end goal is to extract / duplicate the
pathForEndpoint:withVersion:logic so that it can be used outside ofServiceRemoteWordPressComRESTApiVersion. The reason for that is that while all the sync calls can be used across Swift and Objective-C via #777, theasyncone cannot be used in Objective-C and therefore need Swift-only types that do not depend onWordPressComRESTAPIInterfacingTesting Details
No behavior change here. If the unit tests compile, we should be good.
CHANGELOG.mdif necessary. — N.A.