Skip to content

Commit

Permalink
annotate with @_spi(RealmSwiftPrivate)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjchatfield committed Feb 28, 2024
1 parent 36ffd79 commit 4f9a795
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 0 additions & 4 deletions Realm/RLMObjectBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
////////////////////////////////////////////////////////////////////////////

#import <Realm/RLMConstants.h>
#import <Realm/RLMProperty.h>

RLM_HEADER_AUDIT_BEGIN(nullability, sendability)

Expand All @@ -36,9 +35,6 @@ RLM_HEADER_AUDIT_BEGIN(nullability, sendability)
+ (nullable NSString *)_realmObjectName;
+ (nullable NSDictionary<NSString *, NSString *> *)_realmColumnNames;

/// Allow client code to generate properties (ie. via Swift Macros)
+ (nullable NSArray<RLMProperty *> *)_customRealmProperties;

@end

RLM_HEADER_AUDIT_END(nullability, sendability)
4 changes: 0 additions & 4 deletions Realm/RLMObjectBase.mm
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,6 @@ + (NSDictionary *)_realmColumnNames {
return nil;
}

+ (nullable NSArray<RLMProperty *> *)_customRealmProperties {
return nil;
}

+ (bool)_realmIgnoreClass {
return false;
}
Expand Down
9 changes: 9 additions & 0 deletions RealmSwift/Impl/SchemaDiscovery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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<O: ObjectBase, V: _Persistable>(
name: String,
objectType _: O.Type,
Expand Down
2 changes: 1 addition & 1 deletion RealmSwift/Tests/ObjectCustomPropertiesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////

import XCTest
import RealmSwift
@_spi(RealmSwiftPrivate) import RealmSwift

final class ObjectCustomPropertiesTests: TestCase {
override func tearDown() {
Expand Down

0 comments on commit 4f9a795

Please sign in to comment.