SolarTime

struct SolarTime
extension SolarTime : AutomationValue, Copyable, Decodable, Encodable, Equatable, Escapable, Hashable, Sendable, Sendable, StructDataRepresentable

The time of a daily solar event such as sunrise, noon, and sunset.

  • Indicates the type of solar event, either sunrise or sunset.

    Declaration

    Swift

    let type: SolarTime.SolarTimeType
  • Represents seconds before (negative value) or after the solar time.

    Declaration

    Swift

    let offset: Duration
  • Initializes SolarTime with the type and offset.

    Declaration

    Swift

    init(type: SolarTime.SolarTimeType, offset: Duration = .seconds(0))

    Parameters

    type

    The type of solar event, either sunrise or sunset.

    offset

    The time offset from the solar event.

  • Initializes SolarTime with the trait decoder.

    Declaration

    Swift

    init(decoder: TraitDecoder) throws

    Parameters

    decoder

    The trait decoder to decode the solar time.

  • Undocumented

    Declaration

    Swift

    enum SolarTimeType
    extension SolarTime.SolarTimeType : AutomationValue, Decodable, Encodable, Enum, Enum8, Equatable, Hashable, RawRepresentable, Sendable
  • Encodes SolarTime to the trait encoder.

    Declaration

    Swift

    func encode(with encoder: TraitEncoder) throws
  • Undocumented

    Declaration

    Swift

    enum StructFields
    extension SolarTime.StructFields : Equatable, Field, Hashable, RawRepresentable, Sendable
  • Returns the field corresponding to the given field ID.

    Declaration

    Swift

    static func structField(id: UInt32) -> (any Field)?
  • Creates a new instance by decoding from the given decoder.

    This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

    Declaration

    Swift

    init(from decoder: any Decoder) throws