Skip to content
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

CBL-5736: Implement copy for MutableDocument and test #3340

Closed
wants to merge 1 commit into from

Conversation

velicuvlad
Copy link
Contributor

  • Obj-C CBLMutableDocument now implements (CBLMutableDocument*) copy

  • Swift MutableDocument toMutable() marked as deprecated and copy() replacement

@velicuvlad velicuvlad marked this pull request as ready for review November 4, 2024 16:18

@return The CBLMutableDocument object.
*/
- (CBLMutableDocument*) copy;
Copy link
Contributor

Choose a reason for hiding this comment

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

I might be wrong as it has been awhile. I don't remember if we need to explicity define this as the copy is a part of NSObject protocol.

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've searched for it and found that is part of NSObject now. I've tried it before in CBL and copy didnt work (the reason I've filed the ticket in the first place...)

@@ -119,6 +119,10 @@ - (CBLMutableDocument*) mutableCopyWithZone: (NSZone *)zone {
return [[CBLMutableDocument alloc] initAsCopyWithDocument: self dict: _dict];
}

- (CBLMutableDocument*) copy {
return [self mutableCopyWithZone: nil];
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't remember if the default copy calls mutableCopyWithZone or not. Can you double check?

@@ -97,10 +97,18 @@ public final class MutableDocument : Document, MutableDictionaryProtocol {
/// Returns the same MutableDocument object.
///
/// - Returns: The MutableDocument object.
@available(*, deprecated, message: "Use mutableDocument.copy() instead.")
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't deprecate this as toMutable() is our cross-platform API.

@velicuvlad
Copy link
Contributor Author

Will close this PR as is not relevant

@velicuvlad velicuvlad closed this Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants