FirebaseDatabaseSwift Framework Reference

Structures

The following structures are available globally.

  • A property wrapper that marks an Optional<Date> field to be populated with a server timestamp. If a Codable object being written contains a nil for an @ServerTimestamp-annotated field, it will be replaced with ServerValue.timestamp() as it is sent.

    Example:

    struct CustomModel {
      @ServerTimestamp var ts: Date?
    }
    

    Then writing CustomModel(ts: nil) will tell server to fill ts with current timestamp.

    Declaration

    Swift

    @propertyWrapper
    public struct ServerTimestamp : Codable, Equatable, Hashable