Skip to content

Commit

Permalink
Add reference to common weather types to documenation
Browse files Browse the repository at this point in the history
Signed-off-by: Henrik Panhans <[email protected]>
  • Loading branch information
henrik-dmg committed Oct 2, 2024
1 parent 8d1fd56 commit bcada6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- "Sources/**/*.swift"
- "Tests/**/*.swift"
- "**/*.md"
workflow_dispatch:

# Allow one concurrent deployment
concurrency:
Expand Down
20 changes: 12 additions & 8 deletions Sources/HPOpenWeather/Documentation.docc/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,23 @@ openWeatherClient.units = .metric

### Retrieving Weather Information

To fetch the weather, there are two options: async/await or callback. Both expect a ``CLLocationCoordinate2D`` for which to fetch the weather.
To fetch the weather, there are two options: async/await or callback. Both expect a `CLLocationCoordinate2D` for which to fetch the weather.
Additionally, you can specify which fields should be excluded from the response to save bandwidth, or specify a historic date or a date up to 4 days in the future.

See the ``Weather`` and ``CurrentWeather`` types for details on available data.

#### Async

```swift
let weather = try await openWeatherClient.weather(for: CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194))
let coordinate = CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194)
let weather = try await openWeatherClient.weather(for: coordinate)
```

#### Callback

```swift
openWeatherClient.requestWeather(for: CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194)) { result in
let coordinate = CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194)
openWeatherClient.requestWeather(for: coordinate) { result in
switch result {
case .success(let weather):
print(weather)
Expand All @@ -60,9 +64,9 @@ openWeatherClient.requestWeather(for: CLLocationCoordinate2D(latitude: 37.7749,
}
```

### Available languages (default in bold)
### Available languages

- **English**
- English (default)
- Russian
- Italian
- Spanish
Expand All @@ -84,10 +88,10 @@ openWeatherClient.requestWeather(for: CLLocationCoordinate2D(latitude: 37.7749,

See ``WeatherLanguage`` for details.

### Available units (default in bold)
### Available units

- **Metric** (wind speed in m/s, temperature in Celsius)
- Metric (wind speed in m/s, temperature in Celsius, default)
- Imperial (wind speed in mph, temperature in Fahrenheit)
- Standard (wind speed in m/s, temperature in Kelvin)

See ``WeatherUnits`` for details.
See ``WeatherUnits`` for details.

0 comments on commit bcada6c

Please sign in to comment.