NowcastHours

public enum NowcastHours : Int, Codable, CaseIterable, Comparable

Nowcast forecast hours.

  • now

    The current data forecast.

    Declaration

    Swift

    case now = 0
  • The 1 hour of data forecast.

    Declaration

    Swift

    case hour = 1
  • The 2 hours of data forecast.

    Declaration

    Swift

    case twoHours = 2
  • The 3 hours of data forecast.

    Declaration

    Swift

    case threeHours = 3
  • The 4 hours of data forecast.

    Declaration

    Swift

    case fourHours = 4
  • The 5 hours of data forecast.

    Declaration

    Swift

    case fiveHours = 5
  • The 6 hours of data forecast.

    Declaration

    Swift

    case sixHours = 6

Helpers

  • The following titles are used for corresponding cases: Now, +1h, +2h, +3h, +4h, +5h, +6h.

    Declaration

    Swift

    public var title: String { get }
  • Calculates a timestamp from specified data.

    Roundssince date to full hours and appends hours of this enum case. Unix timestamp.

    Declaration

    Swift

    public func ts(since: Date = Date()) -> Int
  • A time range this case represents. Nowcast is an hourly forecast, so each case represent an hour range. Unix timestamps.

    For example, nowcast data received at 10:00 or 10:30 or in range 10:00..10:59 will represent the following time ranges:

    Declaration

    Swift

    public func tsRange(since: Date = Date()) -> ClosedRange<Int>