-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Move post revision related functions to Swift #25009
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
Conversation
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 29904 | |
| Version | PR #25009 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | a04b449 | |
| Installation URL | 3l0uugu5pi8b0 |
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 29904 | |
| Version | PR #25009 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | a04b449 | |
| Installation URL | 7s943l3q11rlo |
| /// True if the content field is empty, independent of the title field. | ||
| public func isContentEmpty() -> Bool { | ||
| let isContentAnEmptyGBParagraph = self.content == "<!-- wp:paragraph -->\n<p></p>\n<!-- /wp:paragraph -->" | ||
| return self.content != nil ? (self.content!.isEmpty || isContentAnEmptyGBParagraph) : true |
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.
(nit) The implementation is not exactly idiomatic Swift. I'd probably do something like:
guard let content, !content.isEmpty else {
return true
}
return content == "<!-- wp:paragraph -->\n<p></p>\n<!-- /wp:paragraph -->"
The same applies to hasContent (force unwrap). They should both also probably be properties and not functions.
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.
I intentionally kept most of the Swift code similar to the original Objective-C code, so that we are more confident in the changes. But I don't mind rewriting some of the code if needed. Updated in a04b449.
d8d279f to
a04b449
Compare
|





Note
This PR will be merged after #25008.
Description
No feature changes, just translating ObjC to Swift. It's easier to review this PR commit by commit.