<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WeatherKit",
  "identifier" : "/documentation/WeatherKit/Forecast",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "WeatherKit"
    ],
    "preciseIdentifier" : "s:10WeatherKit8ForecastV"
  },
  "title" : "Forecast"
}
-->

# Forecast

A forecast collection for minute, hourly, and daily forecasts.

```
struct Forecast<Element> where Element : Decodable, Element : Encodable, Element : Equatable, Element : Sendable
```

## Overview

[`Forecast`](/documentation/WeatherKit/Forecast) conforms to the `RandomAccessCollection` protocol to support efficient random-access index traversal through
forecast types. The protocol involves forwarding the required properties
and methods to the underlying forecast collection. The implementation of `subscript` returns an
instance of the `Element` type.

## Topics

### Creating the forecast

[`init(from:)`](/documentation/WeatherKit/Forecast/init(from:)-390k1)

[`init(from:)`](/documentation/WeatherKit/Forecast/init(from:)-4wobg)

### Serializing objects

[`encode(to:)`](/documentation/WeatherKit/Forecast/encode(to:)-5zuqd)

[`encode(to:)`](/documentation/WeatherKit/Forecast/encode(to:)-fbco)

### Getting the properties

[`endIndex`](/documentation/WeatherKit/Forecast/endIndex)

The forecast end index.

[`forecast`](/documentation/WeatherKit/Forecast/forecast)

The forecast collection.

[`metadata`](/documentation/WeatherKit/Forecast/metadata)

Descriptive information about the forecast data.

[`startIndex`](/documentation/WeatherKit/Forecast/startIndex)

The forecast start index.

[`summary`](/documentation/WeatherKit/Forecast/summary)

A convenient localized description of the minute forecast.

### Accessing elements

[`subscript(_:)`](/documentation/WeatherKit/Forecast/subscript(_:))

The forecast element at the provided index.

[`Index`](/documentation/WeatherKit/Forecast/Index)

The forecast index.

### Comparing forecasts

[`==(_:_:)`](/documentation/WeatherKit/Forecast/==(_:_:))

## Relationships

### Conforms To

[`Sequence`](/documentation/Swift/Sequence)

[`RandomAccessCollection`](/documentation/Swift/RandomAccessCollection)

[`Decodable`](/documentation/Swift/Decodable)

[`Collection`](/documentation/Swift/Collection)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`Encodable`](/documentation/Swift/Encodable)

[`Equatable`](/documentation/Swift/Equatable)

[`BidirectionalCollection`](/documentation/Swift/BidirectionalCollection)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)