diff --git a/RealmSwift/List.swift b/RealmSwift/List.swift index eda16c7546..e3e3756ee8 100644 --- a/RealmSwift/List.swift +++ b/RealmSwift/List.swift @@ -70,7 +70,8 @@ public final class List: ListBase { /// Creates a `List` that holds objects of type `T`. public override init() { - super.init(array: RLMArray(objectClassName: T.className())) + // FIXME: use T.className() + super.init(array: RLMArray(objectClassName: (T.self as Object.Type).className())) } // MARK: Index Retrieval diff --git a/RealmSwift/Object.swift b/RealmSwift/Object.swift index 4dbd4df064..178f11f179 100644 --- a/RealmSwift/Object.swift +++ b/RealmSwift/Object.swift @@ -141,7 +141,8 @@ public class Object: RLMObjectBase { :returns: An `Array` of objects of type `className` which have this object as their value for the `propertyName` property. */ public func linkingObjects(type: T.Type, forProperty propertyName: String) -> [T] { - return RLMObjectBaseLinkingObjectsOfClass(self, T.className(), propertyName) as! [T] + // FIXME: use T.className() + return RLMObjectBaseLinkingObjectsOfClass(self, (T.self as Object.Type).className(), propertyName) as! [T] } diff --git a/RealmSwift/Realm.swift b/RealmSwift/Realm.swift index 83090462ec..8202f6c44b 100644 --- a/RealmSwift/Realm.swift +++ b/RealmSwift/Realm.swift @@ -280,10 +280,12 @@ public final class Realm { :returns: The created object. */ public func create(type: T.Type, value: AnyObject = [:], update: Bool = false) -> T { - if update && schema[T.className()]?.primaryKeyProperty == nil { - throwRealmException("'\(T.className())' does not have a primary key and can not be updated") + // FIXME: use T.className() + let className = (T.self as Object.Type).className() + if update && schema[className]?.primaryKeyProperty == nil { + throwRealmException("'\(className)' does not have a primary key and can not be updated") } - return unsafeBitCast(RLMCreateObjectInRealmWithValue(rlmRealm, T.className(), value, update), T.self) + return unsafeBitCast(RLMCreateObjectInRealmWithValue(rlmRealm, className, value, update), T.self) } // MARK: Deleting objects @@ -350,7 +352,8 @@ public final class Realm { :returns: All objects of the given type in Realm. */ public func objects(type: T.Type) -> Results { - return Results(RLMGetObjects(rlmRealm, T.className(), nil)) + // FIXME: use T.className() + return Results(RLMGetObjects(rlmRealm, (T.self as Object.Type).className(), nil)) } /** @@ -368,7 +371,8 @@ public final class Realm { :returns: An object of type `type` or `nil` if an object with the given primary key does not exist. */ public func objectForPrimaryKey(type: T.Type, key: AnyObject) -> T? { - return unsafeBitCast(RLMGetObject(rlmRealm, type.className(), key), Optional.self) + // FIXME: use T.className() + return unsafeBitCast(RLMGetObject(rlmRealm, (T.self as Object.Type).className(), key), Optional.self) }