Skip to content

Conversation

@crazytonyli
Copy link
Contributor

Description

Translate a few simple Core Data model types into Swift. I hope to eliminate Objective-C code in the WordPressData module, so that we have the option to move it to the SPM package.

It'd be easier to review this PR commit by commit.

@crazytonyli crazytonyli added this to the 26.6 milestone Nov 12, 2025
@crazytonyli crazytonyli requested review from jkmassel and kean November 12, 2025 08:09
@crazytonyli crazytonyli changed the title Core data model to swift Translate a few simple Core Data model types into Swift Nov 12, 2025
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 12, 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 Number29771
VersionPR #24983
Bundle IDcom.jetpack.alpha
Commit1f275c2
Installation URL0eg2pc1pqe4e0
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 12, 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 Number29771
VersionPR #24983
Bundle IDorg.wordpress.alpha
Commit1f275c2
Installation URL545khcjihurho
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@crazytonyli crazytonyli force-pushed the core-data-model-to-swift branch from 14b925c to 2f647ff Compare November 13, 2025 22:12
Copy link
Contributor

@jkmassel jkmassel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me – thanks for the clear commits – that make it a lot easier to review.

return "Category"
}

@objc public static var uncategorizedId: NSNumber {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too sure about uncategorizedId but I understand why it works this way – doing PostCategory.uncategorized would imply that it's a PostCategory object not the default ID.

Probably not worth addressing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have change the name in 1f275c2 to make it consistent with the original ObjC code: PostCategoryUncategorized(objc) -> PostCategory.uncategorized(swift)

Comment on lines 16 to 19
// MARK: - Constants

public let PostCategoryEntityName = "Category"
public let PostCategoryNameKey = "categoryName"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// MARK: - Constants
public let PostCategoryEntityName = "Category"
public let PostCategoryNameKey = "categoryName"

I don't see these referenced anywhere so I think they can be removed? None of the other classes have them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Deleted in dd8b359.


@interface PostCategory : NSManagedObject

@property (nonatomic, strong) NSNumber *categoryID;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changed from optional to non-optional in this PR, but I validated that it's not optional in the Core Data model so the change is valid.

@sonarqubecloud
Copy link

@crazytonyli crazytonyli added this pull request to the merge queue Nov 14, 2025
Merged via the queue into trunk with commit 7c7e831 Nov 14, 2025
28 of 32 checks passed
@crazytonyli crazytonyli deleted the core-data-model-to-swift branch November 14, 2025 09:26
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