ReferenceConvertible
protocol ReferenceConvertible : CustomStringConvertible, CustomDebugStringConvertible, Hashable, Equatable
DatabaseValueConvertible is free for ReferenceConvertible types whose ReferenceType is itself DatabaseValueConvertible.
class FooReference { ... }
struct Foo : ReferenceConvertible {
typealias ReferenceType = FooReference
}
// If the ReferenceType adopts DatabaseValueConvertible...
extension FooReference : DatabaseValueConvertible { ... }
// ... then the ReferenceConvertible type can freely adopt DatabaseValueConvertible:
extension Foo : DatabaseValueConvertible { /* empty */ }
-
Returns a value that can be stored in the database.
Declaration
Swift
public var databaseValue: DatabaseValue
-
Returns a value initialized from databaseValue, if possible.
Declaration
Swift
public static func fromDatabaseValue(_ databaseValue: DatabaseValue) -> Self?