This repository was archived by the owner on Sep 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Change Swift package to provide source code #846
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0fa20af
Reorgnize files
crazytonyli 6c469a1
Delete Info.plist
crazytonyli 666dff0
Replace `#import <WordPressKit/*.h>` statements
crazytonyli ddc54d5
Remove WPKit-Swift.h
crazytonyli 6b696bc
Translate RemoteUser to Swift
crazytonyli 19585fb
Rearrange files
crazytonyli c8b0bb0
Fix imports
crazytonyli ba19dee
Remove _implementationOnly imports
crazytonyli 3133cba
Minor syntactical changes
crazytonyli 388b86c
Remove WordPressKit.h
crazytonyli e93e791
Translate PostServiceRemoteREST.getLikesForPostID to Swift
crazytonyli abaf0ec
Add Package.swift
crazytonyli 6a8e615
Convert the Objective-C protocol to a Swift concrete type
crazytonyli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
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
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...sKit/Services/AccountSettingsRemote.swift → .../WordPressKit/AccountSettingsRemote.swift
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
1 change: 1 addition & 0 deletions
1
Sources/WordPressKit/Models/Activity.swift → Sources/WordPressKit/Activity.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import Foundation | ||
| import WordPressKitModels | ||
|
|
||
| public struct Activity: Decodable { | ||
|
|
||
|
|
||
1 change: 1 addition & 0 deletions
1
...sKit/Services/ActivityServiceRemote.swift → .../WordPressKit/ActivityServiceRemote.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import Foundation | ||
| import WordPressKitObjC | ||
|
|
||
| open class ActivityServiceRemote: ServiceRemoteWordPressComREST { | ||
|
|
||
|
|
||
3 changes: 3 additions & 0 deletions
3
...ActivityServiceRemote_ApiVersion1_0.swift → ...ActivityServiceRemote_ApiVersion1_0.swift
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
1 change: 1 addition & 0 deletions
1
.../Services/AnnouncementServiceRemote.swift → ...dPressKit/AnnouncementServiceRemote.swift
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
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...s/AtomicAuthenticationServiceRemote.swift → ...t/AtomicAuthenticationServiceRemote.swift
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
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...it/Services/AtomicSiteServiceRemote.swift → ...ordPressKit/AtomicSiteServiceRemote.swift
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
1 change: 1 addition & 0 deletions
1
...t/Services/AutomatedTransferService.swift → ...rdPressKit/AutomatedTransferService.swift
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...ressKit/Services/BlazeServiceRemote.swift → ...ces/WordPressKit/BlazeServiceRemote.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import Foundation | ||
| import WordPressKitObjC | ||
|
|
||
| open class BlazeServiceRemote: ServiceRemoteWordPressComREST { | ||
|
|
||
|
|
||
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...es/BlogJetpackSettingsServiceRemote.swift → ...it/BlogJetpackSettingsServiceRemote.swift
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
3 changes: 3 additions & 0 deletions
3
...rvices/BloggingPromptsServiceRemote.swift → ...essKit/BloggingPromptsServiceRemote.swift
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
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...ices/CommentServiceRemoteREST+ApiV2.swift → ...sKit/CommentServiceRemoteREST+ApiV2.swift
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
1 change: 1 addition & 0 deletions
1
...Kit/Services/DashboardServiceRemote.swift → ...WordPressKit/DashboardServiceRemote.swift
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
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...els/Extensions/Decodable+Dictionary.swift → ...s/WordPressKit/Decodable+Dictionary.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import Foundation | ||
| struct JSONCodingKeys: CodingKey { | ||
| var stringValue: String | ||
|
|
||
|
|
||
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...rvices/Domains/DomainsServiceRemote.swift → ...s/WordPressKit/DomainsServiceRemote.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import Foundation | ||
| import WordPressKitObjC | ||
|
|
||
| /// Allows the construction of a request for domain suggestions. | ||
| /// | ||
|
|
||
1 change: 1 addition & 0 deletions
1
...essKit/Services/EditorServiceRemote.swift → ...es/WordPressKit/EditorServiceRemote.swift
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
1 change: 1 addition & 0 deletions
1
.../WordPressKit/Models/EditorSettings.swift → Sources/WordPressKit/EditorSettings.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import Foundation | ||
| private struct RemoteEditorSettings: Codable { | ||
| let editorMobile: String | ||
| let editorWeb: String | ||
|
|
||
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...sions/Enum+UnknownCaseRepresentable.swift → ...ssKit/Enum+UnknownCaseRepresentable.swift
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| @_exported import WordPressKitModels | ||
| @_exported import WordPressKitObjC | ||
| @_exported import WordPressKitObjCUtils | ||
|
|
||
| extension ServiceRemoteWordPressComREST { | ||
| public var wordPressComRestApi: WordPressComRestApi { | ||
| self.wordPressComRESTAPI as! WordPressComRestApi | ||
| } | ||
| } | ||
|
|
||
| extension ServiceRemoteWordPressXMLRPC { | ||
| public var xmlrpcApi: WordPressOrgXMLRPCApi { | ||
| self.api as! WordPressOrgXMLRPCApi | ||
| } | ||
| } | ||
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...PressKit/Services/FeatureFlagRemote.swift → Sources/WordPressKit/FeatureFlagRemote.swift
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
Sources/CoreAPI/HTTPRequestBuilder.swift → ...ces/WordPressKit/HTTPRequestBuilder.swift
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
1 change: 1 addition & 0 deletions
1
...vices/HomepageSettingsServiceRemote.swift → ...ssKit/HomepageSettingsServiceRemote.swift
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...Services/JetpackBackupServiceRemote.swift → ...PressKit/JetpackBackupServiceRemote.swift
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
1 change: 1 addition & 0 deletions
1
...es/JetpackCapabilitiesServiceRemote.swift → ...it/JetpackCapabilitiesServiceRemote.swift
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
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...ement/JetpackPluginManagementClient.swift → ...ssKit/JetpackPluginManagementClient.swift
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
3 changes: 3 additions & 0 deletions
3
.../Services/JetpackProxyServiceRemote.swift → ...dPressKit/JetpackProxyServiceRemote.swift
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...t/Services/JetpackScanServiceRemote.swift → ...rdPressKit/JetpackScanServiceRemote.swift
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
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...ssKit/Services/JetpackServiceRemote.swift → ...s/WordPressKit/JetpackServiceRemote.swift
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
3 changes: 3 additions & 0 deletions
3
...Services/JetpackSocialServiceRemote.swift → ...PressKit/JetpackSocialServiceRemote.swift
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 1 addition & 8 deletions
9
...s/NotificationSettingsServiceRemote.swift → ...t/NotificationSettingsServiceRemote.swift
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
1 change: 1 addition & 0 deletions
1
...vices/NotificationSyncServiceRemote.swift → ...ssKit/NotificationSyncServiceRemote.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import Foundation | ||
| import WordPressKitObjC | ||
|
|
||
| // MARK: - NotificationSyncServiceRemote | ||
| // | ||
|
|
||
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...essKit/Services/PeopleServiceRemote.swift → ...es/WordPressKit/PeopleServiceRemote.swift
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
1 change: 1 addition & 0 deletions
1
...it/Services/Plans/PlanServiceRemote.swift → Sources/WordPressKit/PlanServiceRemote.swift
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
1 change: 1 addition & 0 deletions
1
...ans/PlanServiceRemote_ApiVersion1_3.swift → ...Kit/PlanServiceRemote_ApiVersion1_3.swift
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...essKit/Services/PluginServiceRemote.swift → ...es/WordPressKit/PluginServiceRemote.swift
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need to translate this function to Swift, because it's used in a Swift module. I'll explain a little bit more of why this is needed in the upcoming app PR (which would provide a full context).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks good. We'll just need to make sure we test the features that needed rewrite. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import WordPressKitObjC | ||
| import NSObject_SafeExpectations | ||
|
|
||
| extension PostServiceRemoteREST { | ||
|
|
||
| /// Requests a list of users that liked the post with the specified ID. | ||
| /// | ||
| /// Due to the API limitation, up to 90 users will be returned from the endpoint. | ||
| /// | ||
| /// - Parameters: | ||
| /// - postID: The ID for the post. Cannot be nil. | ||
| /// - count: Number of records to retrieve. Cannot be nil. If 0, will default to endpoint max. | ||
| /// - before: Filter results to Likes before this date/time string. Can be nil. | ||
| /// - excludeUserIDs: Array of user IDs to exclude from response. Can be nil. | ||
| /// - success: The block that will be executed on success. Can be nil. | ||
| /// - failure: The block that will be executed on failure. Can be nil. | ||
| @objc(getLikesForPostID:count:before:excludeUserIDs:success:failure:) | ||
| public func getLikesForPostID( | ||
| _ postID: NSNumber, | ||
| count: NSNumber, | ||
| before: String?, | ||
| excludeUserIDs: [NSNumber]?, | ||
| success: (([RemoteLikeUser], NSNumber) -> Void)?, | ||
| failure: ((Error?) -> Void)? | ||
| ) { | ||
| let path = "sites/\(siteID)/posts/\(postID)/likes" | ||
| let requestUrl = self.path(forEndpoint: path, withVersion: ._1_2) | ||
| let siteID = self.siteID | ||
|
|
||
| // If no count provided, default to endpoint max. | ||
| var parameters: [String: Any] = ["number": count == 0 ? 90 : count] | ||
|
|
||
| if let before { | ||
| parameters["before"] = before | ||
| } | ||
|
|
||
| if let excludeUserIDs { | ||
| parameters["exclude"] = excludeUserIDs | ||
| } | ||
|
|
||
| wordPressComRESTAPI.get(requestUrl, | ||
| parameters: parameters, | ||
| success: { (responseObject, httpResponse) in | ||
| if let success { | ||
| let responseDict = responseObject as? [String: Any] ?? [:] | ||
| let jsonUsers = responseDict["likes"] as? [[String: Any]] ?? [] | ||
| let users = jsonUsers.map { RemoteLikeUser(dictionary: $0, postID: postID, siteID: siteID) } | ||
| let found = responseDict["found"] as? NSNumber ?? 0 | ||
| success(users, found) | ||
| } | ||
| }, failure: { (error, _) in | ||
| failure?(error) | ||
| }) | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
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.
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.
We have to use an interface type in the ServiceRemoteWordPressComREST.h, because the implementation is in the Swift
WordPressKitmodule.In practice,
WordPressComRestApiis the only acceptable instance to createServiceRemoteWordPressComREST, so, we'll do a little bit hack here to force cast in runtime.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.
Same as the
WordPressOrgXMLRPCApiproperty below.