Re-implement a few remote post related types#559
Re-implement a few remote post related types#559crazytonyli merged 3 commits intotranslate-objc-to-swiftfrom
Conversation
d0ff67a to
0d00215
Compare
WordPressKit/RemotePost.swift
Outdated
| public static let statusDraft = "draft" | ||
| public static let statusPending = "pending" | ||
| public static let statusPrivate = "private" | ||
| public static let statusPublish = "publish" | ||
| public static let statusScheduled = "future" | ||
| public static let statusTrash = "trash" | ||
| public static let statusDeleted = "deleted" // Returned by wpcom REST API when a post is permanently deleted. |
There was a problem hiding this comment.
I was going to suggest to define a Status enum, but I guess that wouldn't work because of the @objcMembers requirement.
There was a problem hiding this comment.
Although... I guess we could define the enum in an extension and use it here in the assignment?
extension RemotePost {
enum Status: String {
case draft
case pending
...
...
public static let statusDraft = Status.draft.rawValue
public static let statusPending = Status.pending.rawValue
...There was a problem hiding this comment.
Yes, definitely. There are lots of space to make the translated code "more Swift". I'm currently looking into the model's parsing code and in turn may change their property declarations, which kind of relate to your proposal here.
| public override var debugDescription: String { | ||
| "\(super.description) (\(allProperties))" | ||
| } |
There was a problem hiding this comment.
TIL debugDescription.
The debugger’s
pocommand uses this property to create a textual representation of the object suitable for display in the debugger. The default implemention [sic] returns the same value as description. Override either property to provide custom object descriptions.
|
I've changed the base branch to the dedicated Swift migration branch, see #562 for more context. |
Co-authored-by: Gio Lodi <gio.lodi@automattic.com>
Description
Similar to #556, this PR is part of re-implementing Objective-C files in Swift.
versionin the.podspecfile.