-
Notifications
You must be signed in to change notification settings - Fork 297
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,6 +119,10 @@ - (CBLMutableDocument*) mutableCopyWithZone: (NSZone *)zone { | |
return [[CBLMutableDocument alloc] initAsCopyWithDocument: self dict: _dict]; | ||
} | ||
|
||
- (CBLMutableDocument*) copy { | ||
return [self mutableCopyWithZone: nil]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
} | ||
|
||
#pragma mark - CBLMutableDictionary | ||
|
||
- (void) setValue: (nullable id)value forKey: (NSString*)key { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We shouldn't deprecate this as toMutable() is our cross-platform API. |
||
public override func toMutable() -> MutableDocument { | ||
return self; | ||
} | ||
|
||
/// Returns the same MutableDocument object. | ||
/// | ||
/// - Returns: The MutableDocument object. | ||
public func copy() -> MutableDocument { | ||
return self; | ||
} | ||
|
||
// MARK: Type Setters | ||
|
||
/// Set a value for the given key. Allowed value types are Array, Date, Dictionary, | ||
|
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 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.
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'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...)