DarkSkyKit
DarkSky.net API client written in Swift.
Install / Use
/learn @modo-studio/DarkSkyKitREADME

DarkSky.net API client written in Swift.
Usage
import DarkSkyKit
Init
Basic Configuration
Init the DarkSkyKit client using only the api token.
let forecastClient = DarkSkyKit(apiToken: "AAA")
Extended Configuration
Init the DarkSkyKit client using a custom configuration. Check out the darksky.net documentation to know more about these properties (units, exclude, extend & language).
let c = Configuration(token: "AAA", units: .si, exclude: .alerts, lang: "ES")
let forecastClient = DarkSkyKit(configuration: c)
Fetch
DarkSkt.net API provides 2 ways of fetch weather data: current and time machine.
Current
Fetch current weather conditions based on a given location.
forecastClient.current(latitude: 0.34565, longitude: 1.64559) { result in
switch result {
case .success(let forecast):
// Manage weather data using the Forecast model. Ex:
if let current = forecast.currently {
let t = current.temperature
}
case .failure(let error):
// Manage error case
}
}
Time Machine
Fetch weather conditions based on a given date and location.
let d = NSDate(timeIntervalSinceNow: timestamp)
forecastClient.current(latitude: 0.34565, longitude: 1.64559, date: d) { result in
// Manage result
}
Requirements
- iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
- Xcode 7.3+
Installation
To install it, simply add the following line to your Podfile:
pod "DarkSkyKit"
About
<img src="https://github.com/carambalabs/Foundation/blob/master/ASSETS/logo-salmon.png?raw=true" width="200" />This project is funded and maintained by Caramba. We 💛 open source software!
Check out our other open source projects, read our blog or say :wave: on twitter @carambalabs.
Contribute
Contributions are welcome :metal: We encourage developers like you to help us improve the projects we've shared with the community. Please see the Contributing Guide and the Code of Conduct.
License
DarkSkyKit is available under the MIT license. See the LICENSE file for more info.
Related Skills
node-connect
339.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.9kCommit, push, and open a PR
