Latest 1.0.7
Homepage https://github.com/nishanths/YWeatherAPI
License MIT
Platforms ios 6.0, osx 10.8, requires ARC
Dependencies AFNetworking
Frameworks CoreLocation
Authors

YWeatherAPI

A powerful API wrapper for Yahoo Weather for iOS and Mac. Built on top of AFNetworking’s blocks-based architecture, it fetches responses asynchronously without any waiting on the main thread.

This document provides a quick overview. Check out the full documentation.

The Yahoo Weather API does not require an API key.

Version
License
Platform

Contents

Installation

CocoaPods (Recommended)

YWeatherAPI is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'YWeatherAPI'

And then from terminal, run:

$ pod install
Manual

Clone the repo and add all the files in the Pod/Classes directory to your Xcode target.

Getting Started

Include the header file
#import <YWeatherAPI/YWeatherAPI.h>
Shared Singleton

Use the shared singleton to make requests:

[YWeatherAPI sharedManager];
Example

Getting the current temperature is as simple as:

[[YWeatherAPI sharedManager] temperatureForLocation:@"Redwood City, California"
                                            success:^(NSDictionary* result)
    {
        NSString* temperature = [result objectForKey:kYWAIndex];
        NSLog(@"The temperature is a pleasant %@ F", temperature);
    }
                                            failure:^(id response, NSError* error)
    {
        // Yikes, something went wrong
    }
];
Success result

The result in the success callback in the example is this NSDictionary object:

{
    city = "Redwood City"; 
    country = "United States"; 
    index = 72; // key @"index" (the detail you asked for)
    latitude = "37.5"; 
    longitude = "-122.23"; 
    region = CA; 
    temperatureInC = "22.22";
    temperatureInF = 72;
}

See YWeatherAPI.h for a complete list of keys and data types.

Customizing Defaults

Customize the default weather units to be returned, enable caching of results, set the cache expiry duration, and more.

[YWeatherAPI sharedManager].defaultPressureUnit = MB;
[YWeatherAPI sharedManager].cacheEnabled = YES;
[YWeatherAPI sharedManager].cacheExpiryInMinutes = 10;

Features

  • Caching results, with customizable cache expiry times.
  • Looking up weather data by CLLocation, natural-language location string, and Yahoo WOEID.
  • Looking up weather data in customizable pressure, distance, speed, and temperature units.

Documentation

The full documentation is at CocoaDocs.

FAQs

Do I need an API key?

No, you do not. Yahoo Weather currently does not require an API key to access most of its content, so this API wrapper does not require one either. Please be respectful of this power.

The requirement for an API key may change in the future. If it does, care will be taken to follow semantic versioning rules for backwards compatibility.

Do I need to know YQL (Yahoo Query Language) to use this?

Nope.

Requirements

YWeatherAPI works on Mac OS X 10.8+ and iOS 6.0+.

  • CoreLocation is required to reverse geocode coordinates.
  • AFNetworking ~>2.0 is a dependency and is automatically installed along with YWeatherAPI if it isn’t already.

Contributing

  • New features, bug fixes, and additional documentation and tests are welcome! Please fork the repository and request to be merged into the master branch. Yes, I too like to live dangerously.
  • Alternatively, if you have a feature request or find a bug, please let me know here, on Twitter, or email.

License

YWeatherAPI is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "YWeatherAPI",
    "version": "1.0.7",
    "summary": "Powerful Yahoo Weather API wrapper for iOS and Mac.",
    "description": "A powerful API wrapper for [Yahoo Weather](https://developer.yahoo.com/weather/) for iOS and Mac. Built on top of AFNetworkingu2019s blocks-based architecture, it fetches responses asynchronously without any waiting on the main thread. It supports:nnn* Caching results with customizable expiry times,n* Requesting forecasts by natural-language location strings, `CLLocation` coordinates, and Yahoo WOEIDs,n* Customizing default temperature, pressure, speed, and distance return units.",
    "homepage": "https://github.com/nishanths/YWeatherAPI",
    "license": "MIT",
    "authors": {
        "Nishanth Shanmugham": "[email protected]"
    },
    "social_media_url": "http://twitter.com/nshanmugham",
    "source": {
        "git": "https://github.com/nishanths/YWeatherAPI.git",
        "tag": "1.0.7"
    },
    "source_files": "Pod/Classes/**/*",
    "public_header_files": "Pod/Classes/YWeatherAPI.h",
    "frameworks": "CoreLocation",
    "requires_arc": true,
    "dependencies": {
        "AFNetworking": [
            "~> 2.0"
        ]
    },
    "platforms": {
        "ios": "6.0",
        "osx": "10.8"
    }
}

Pin It on Pinterest

Share This