Skip to content

Commit 580d8ae

Browse files
author
Clément Le Provost
committed
Fix NSCopying support in Objective-C
1 parent 2128938 commit 580d8ae

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Source/Query.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,13 @@ public class Query : NSObject, NSCopying {
10661066

10671067
@objc(Query)
10681068
public class _objc_Query: Query {
1069+
/// MARK: `NSCopying` support
1070+
1071+
@objc public override func copy(with zone: NSZone?) -> Any {
1072+
// NOTE: As per the docs, the zone argument is ignored.
1073+
return _objc_Query(copy: self)
1074+
}
1075+
10691076
// MARK: Properties
10701077

10711078
@objc(queryType)

Tests/ObjectiveCBridging.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ - (void)testQuery {
6565

6666
// Copying.
6767
Query* query2 = [query copy];
68+
XCTAssertEqualObjects([query2 class], [Query class]);
6869
XCTAssertEqualObjects(query, query2);
6970

7071
// Building/parsing.

0 commit comments

Comments
 (0)