From 4f9a795d287a48ed6ba78f03be141bd4c29f9b4b Mon Sep 17 00:00:00 2001 From: Robert J Chatfield Date: Wed, 28 Feb 2024 14:42:04 +1000 Subject: [PATCH] annotate with `@_spi(RealmSwiftPrivate)` --- Realm/RLMObjectBase.h | 4 ---- Realm/RLMObjectBase.mm | 4 ---- RealmSwift/Impl/SchemaDiscovery.swift | 9 +++++++++ RealmSwift/Tests/ObjectCustomPropertiesTests.swift | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Realm/RLMObjectBase.h b/Realm/RLMObjectBase.h index 2d07f2fa10..7e9c83c8fe 100644 --- a/Realm/RLMObjectBase.h +++ b/Realm/RLMObjectBase.h @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////////////// #import -#import RLM_HEADER_AUDIT_BEGIN(nullability, sendability) @@ -36,9 +35,6 @@ RLM_HEADER_AUDIT_BEGIN(nullability, sendability) + (nullable NSString *)_realmObjectName; + (nullable NSDictionary *)_realmColumnNames; -/// Allow client code to generate properties (ie. via Swift Macros) -+ (nullable NSArray *)_customRealmProperties; - @end RLM_HEADER_AUDIT_END(nullability, sendability) diff --git a/Realm/RLMObjectBase.mm b/Realm/RLMObjectBase.mm index 0131bfe50e..a31310fe43 100644 --- a/Realm/RLMObjectBase.mm +++ b/Realm/RLMObjectBase.mm @@ -346,10 +346,6 @@ + (NSDictionary *)_realmColumnNames { return nil; } -+ (nullable NSArray *)_customRealmProperties { - return nil; -} - + (bool)_realmIgnoreClass { return false; } diff --git a/RealmSwift/Impl/SchemaDiscovery.swift b/RealmSwift/Impl/SchemaDiscovery.swift index a6fa031435..81dd18cf16 100644 --- a/RealmSwift/Impl/SchemaDiscovery.swift +++ b/RealmSwift/Impl/SchemaDiscovery.swift @@ -39,6 +39,14 @@ public protocol _RealmSchemaDiscoverable { static func _rlmPopulateProperty(_ prop: RLMProperty) } +extension RLMObjectBase { + /// Allow client code to generate properties (ie. via Swift Macros) + @_spi(RealmSwiftPrivate) + @objc open class func _customRealmProperties() -> [RLMProperty]? { + return nil + } +} + internal protocol SchemaDiscoverable: _RealmSchemaDiscoverable {} extension SchemaDiscoverable { public static var _rlmOptional: Bool { false } @@ -63,6 +71,7 @@ extension RLMProperty { /// Exposed for Macros. /// Important: Keep args in same order & default value as `@Persisted` property wrapper + @_spi(RealmSwiftPrivate) public convenience init( name: String, objectType _: O.Type, diff --git a/RealmSwift/Tests/ObjectCustomPropertiesTests.swift b/RealmSwift/Tests/ObjectCustomPropertiesTests.swift index 7bf5d3dd74..af9d79fb53 100644 --- a/RealmSwift/Tests/ObjectCustomPropertiesTests.swift +++ b/RealmSwift/Tests/ObjectCustomPropertiesTests.swift @@ -17,7 +17,7 @@ //////////////////////////////////////////////////////////////////////////// import XCTest -import RealmSwift +@_spi(RealmSwiftPrivate) import RealmSwift final class ObjectCustomPropertiesTests: TestCase { override func tearDown() {