Structures
The following structures are available globally.
-
A property wrapper that marks an
Optional<Date>
field to be populated with a server timestamp. If aCodable
object being written contains anil
for an@ServerTimestamp
-annotated field, it will be replaced withServerValue.timestamp()
as it is sent.Example:
struct CustomModel { @ServerTimestamp var ts: Date? }
Then writing
CustomModel(ts: nil)
will tell server to fillts
with current timestamp.Declaration
Swift
@propertyWrapper public struct ServerTimestamp : Codable, Equatable, Hashable