ForecastView
ForecastView copied to clipboard
Extensible View subclass that displays the weather forecast of a given CLLocationCoordinate2D. Written in Swift ❤️
ForecastView

Usage
Using the custom view is straightforward, the following code gets the instance of the library from a Storyboard and proceeds to use the Wunderground.com datasource to fetch the weather forecast for the city Valencia, Venezuela
(10.162 latitude and -68.0077 longitude)
import UIKit
import CoreLocation
import ForecastView
class ViewController: UIViewController {
@IBOutlet weak var forecastView: ForecastView!
override func viewDidLoad() {
super.viewDidLoad()
// Init the Forecast View
forecastView.datasource = WundergroundDatasource(apiKey: "YOUR-API-KEY-FROM-WUNDERGROUND.COM")
forecastView.coordinates = CLLocationCoordinate2DMake(10.162, -68.0077)
}
}
A beautiful icon set created by Carlos Yllobre is bundled with the Example
project.
Extending
If you wish to use other datasources, just create a class that implements the ForecastDatasource protocol. It's that easy.
Want to use your own icons? Supply the icon filename in the Conditions model. Checkout the ConditionsView for more information about this.
Installation
Manual
The easiest way to install this framework is to drag and drop the ForecastView/ForecastView
folder into your project. This also prevents the frameworks
problem in iOS where the IBInspectable and IBDesignable are stripped out.
CocoaPods
Add the following to your Podfile:
use_frameworks!
pod "ForecastView"
Carthage
Add the following to your Cartfile:
github "raulriera/ForecastView"
Swift 1.2
Looking for a Swift 1.2 version? Try the swift-1.2
branch.
Created by
Raul Riera, @raulriera
Carlos Yllobre @charlieyllobre