https://github.com/bourvill/openweatherkit
:partly_sunny: Swift OpenWeatherMap Kit :partly_sunny:
https://github.com/bourvill/openweatherkit
cocoapods ios ios-sdk openweathermap swift weather
Last synced: 8 months ago
JSON representation
:partly_sunny: Swift OpenWeatherMap Kit :partly_sunny:
- Host: GitHub
- URL: https://github.com/bourvill/openweatherkit
- Owner: bourvill
- License: mit
- Created: 2016-07-20T12:03:21.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-07-10T15:15:09.000Z (almost 3 years ago)
- Last Synced: 2025-09-22T10:12:53.240Z (9 months ago)
- Topics: cocoapods, ios, ios-sdk, openweathermap, swift, weather
- Language: Swift
- Homepage:
- Size: 171 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenWeatherKit
[](https://www.bitrise.io/app/c0f61c2208d69ebf)
[](https://travis-ci.org/bourvill/OpenWeatherKit)
[](http://cocoapods.org/pods/OpenWeatherKit)
[](http://cocoapods.org/pods/OpenWeatherKit)
[](http://cocoapods.org/pods/OpenWeatherKit)
OpenWeatherKit is a library written in Swift.
## Requirements
- iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+
- Xcode 9.2+
- Swift 4.0+
## Installation
### CocoaPods
[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
```bash
$ gem install cocoapods
```
> CocoaPods 1.3.1+ is required to build OpenWeatherKit.
To integrate OpenWeatherKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
pod 'OpenWeatherKit'
```
Then, run the following command:
```bash
$ pod install
```
## Usage
### Method available
[] Weather
[X] Latitude Longitude
[X] OpenWeatheMap City id
[] ForeCast
[X] Latitude Longitude
[X] OpenWeatheMap City id
### Code Implementation
First:
```swift
import OpenWeatherKit
```
In your view controller's
```swift
let weatherApi = WeatherApi(key: "YOUR_OPEN_WEATHER_API_KEY")
weatherApi.getWeatherFor(lat: "5.567788", lon: "1.5544") { result in
switch result {
case .success(let weather):
self.cityLabel.text = weather.name
self.tempLabel.text = "\(weather.main.temp)"
case .error(_):
//Do something
break
}
}
```
## License
OpenWeatherKit is released under the MIT license.