object(ofType:forPrimaryKey:)

public func object<Element: Object, KeyType>(ofType type: Element.Type, forPrimaryKey key: KeyType) -> Element?

Retrieves the single instance of a given object type with the given primary key from the Realm.

This method requires that primaryKey() be overridden on the given object class.

  • Declaration

    Swift

    public func object<Element: Object, KeyType>(ofType type: Element.Type, forPrimaryKey key: KeyType) -> Element?
  • Declaration

    Swift

    public func object<Element: Object, KeyType>(ofType type: Element.Type, forPrimaryKey key: KeyType) -> Element?