123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- import Realm
- public final class ObjectiveCSupport {
-
- public static func convert<T>(object: Results<T>) -> RLMResults<AnyObject> {
- return object.rlmResults
- }
-
- public static func convert(object: RLMResults<AnyObject>) -> Results<Object> {
- return Results(object)
- }
-
- public static func convert<T>(object: List<T>) -> RLMArray<AnyObject> {
- return object._rlmArray
- }
-
- public static func convert(object: RLMArray<AnyObject>) -> List<Object> {
- return List(rlmArray: object)
- }
-
- public static func convert<T>(object: LinkingObjects<T>) -> RLMResults<AnyObject> {
- return object.rlmResults
- }
-
- public static func convert(object: RLMLinkingObjects<RLMObject>) -> Results<Object> {
- return Results(object)
- }
-
- public static func convert(object: Realm) -> RLMRealm {
- return object.rlmRealm
- }
-
- public static func convert(object: RLMRealm) -> Realm {
- return Realm(object)
- }
-
- public static func convert(object: Migration) -> RLMMigration {
- return object.rlmMigration
- }
-
- public static func convert(object: RLMMigration) -> Migration {
- return Migration(object)
- }
-
- public static func convert(object: ObjectSchema) -> RLMObjectSchema {
- return object.rlmObjectSchema
- }
-
- public static func convert(object: RLMObjectSchema) -> ObjectSchema {
- return ObjectSchema(object)
- }
-
- public static func convert(object: Property) -> RLMProperty {
- return object.rlmProperty
- }
-
- public static func convert(object: RLMProperty) -> Property {
- return Property(object)
- }
-
- public static func convert(object: Realm.Configuration) -> RLMRealmConfiguration {
- return object.rlmConfiguration
- }
-
- public static func convert(object: RLMRealmConfiguration) -> Realm.Configuration {
- return .fromRLMRealmConfiguration(object)
- }
-
- public static func convert(object: Schema) -> RLMSchema {
- return object.rlmSchema
- }
-
- public static func convert(object: RLMSchema) -> Schema {
- return Schema(object)
- }
-
- public static func convert(object: SortDescriptor) -> RLMSortDescriptor {
- return object.rlmSortDescriptorValue
- }
-
- public static func convert(object: RLMSortDescriptor) -> SortDescriptor {
- return SortDescriptor(keyPath: object.keyPath, ascending: object.ascending)
- }
-
- public static func convert(object: SyncCredentials) -> RLMSyncCredentials {
- return RLMSyncCredentials(object)
- }
-
- public static func convert(object: RLMSyncCredentials) -> SyncCredentials {
- return SyncCredentials(object)
- }
-
- public static func convert(object: @escaping RLMShouldCompactOnLaunchBlock) -> (Int, Int) -> Bool {
- return { totalBytes, usedBytes in
- return object(UInt(totalBytes), UInt(usedBytes))
- }
- }
-
- public static func convert(object: @escaping (Int, Int) -> Bool) -> RLMShouldCompactOnLaunchBlock {
- return { totalBytes, usedBytes in
- return object(Int(totalBytes), Int(usedBytes))
- }
- }
-
- public static func convert(object: SyncConfiguration) -> RLMSyncConfiguration {
- return object.asConfig()
- }
-
- public static func convert(object: RLMSyncConfiguration) -> SyncConfiguration {
- return SyncConfiguration(config: object)
- }
- }
|