This repository was archived by the owner on Sep 15, 2025. It is now read-only.
SPM Prep - Isolate API version enum and convert to modern Objective-C#778
Merged
SPM Prep - Isolate API version enum and convert to modern Objective-C#778
Conversation
mokagio
commented
Apr 4, 2024
| 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) |
Contributor
Author
There was a problem hiding this comment.
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.
Contributor
There was a problem hiding this comment.
You can avoid this name change by adding a NS_SWIFT_NAME(path(forEndpoint:withVersion:)) to the function in the ObjC header.
Contributor
Author
There was a problem hiding this comment.
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.
Base automatically changed from
mokagio/convert-all-wordpresscomrestapi-swift
to
trunk
April 4, 2024 22:12
c437048 to
25efc1f
Compare
25efc1f to
071a046
Compare
crazytonyli
approved these changes
Apr 5, 2024
This should help with isolating the value so that we can further extract the path logic in the Swift implementation.
071a046 to
ee3d90b
Compare
Contributor
Author
|
Force pushed to resolve merge conflict without having to add merge commit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.