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.

CI Status Version License Platform



CocoaPods (Recommended)

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

pod 'YWeatherAPI', '~> 1.0'

And then from terminal, run:

$ pod install

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

Getting Started

This section provides a quick overview to get started. For more, see this article for plenty of examples, or check out the full documentation.
Include the header file
#import <YWeatherAPI/YWeatherAPI.h>
Shared Singleton

Use the shared singleton to make requests:

[YWeatherAPI sharedManager];

Getting the current temperature is as simple as:

[[YWeatherAPI sharedManager] temperatureForLocation:@"Redwood City, California"
                                            success:^(NSDictionary* result)
        NSString* temperature = [result objectForKey:kYWAIndex]; 
                                            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;


  • 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.


The full documentation is at CocoaDocs.


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 respect semantic versioning rules and backwards compatibility.

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



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.


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


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

Share this project: