Skip to content

Conversation

@crazytonyli
Copy link
Contributor

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.

@crazytonyli crazytonyli added this to the 26.6 milestone Nov 24, 2025
@crazytonyli crazytonyli requested review from jkmassel and kean November 24, 2025 01:52
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 24, 2025

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number29904
VersionPR #25009
Bundle IDcom.jetpack.alpha
Commita04b449
Installation URL3l0uugu5pi8b0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 24, 2025

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number29904
VersionPR #25009
Bundle IDorg.wordpress.alpha
Commita04b449
Installation URL7s943l3q11rlo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

/// 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
Copy link
Contributor

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.

Copy link
Contributor Author

@crazytonyli crazytonyli Nov 25, 2025

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.

Base automatically changed from core-data-models-unused-functions to trunk November 25, 2025 02:23
@crazytonyli crazytonyli force-pushed the core-data-models-posts branch from d8d279f to a04b449 Compare November 25, 2025 02:41
@sonarqubecloud
Copy link

@kean kean self-requested a review November 28, 2025 15:09
@crazytonyli crazytonyli added this pull request to the merge queue Nov 28, 2025
Merged via the queue into trunk with commit 6a50a4d Nov 28, 2025
30 of 32 checks passed
@crazytonyli crazytonyli deleted the core-data-models-posts branch November 28, 2025 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants