A library for Search & Parse the weather data from Wunderground & Openweathermap conveniently.

Overview

SmileWeather

GitHub Issues Version License Platform

A library for Search & Parse the weather data from Wunderground & Openweathermap conveniently.

#What can it do for you?

1. Handle all complicated things about Search & Parse the weather data.

For example, you can search place by using -(void)getPlacemarksFromString:(NSString*)string completion:(SmileWeatherPlacemarksCompletion)completion, the completion block return array of the CLPlacemark.

[[SmileWeatherDownLoader sharedDownloader] getPlacemarksFromString:@"cupertino" completion:^(NSArray *placeMarks, NSError *error) {
        if (!error) {
            //search results: array of placemark in here
        }
    }];

You can get the placemark's weather data by using -(void)getWeatherDataFromPlacemark:(CLPlacemark*)placeMark completion:(SmileWeatherDataDownloadCompletion)completion;, the completion block return well formed weather data SmileWeatherData.

[[SmileWeatherDownLoader sharedDownloader] getWeatherDataFromPlacemark:placemark completion:^(SmileWeatherData *data, NSError *error) {
        if (!error) {
            //Well formed weather data in here.
        }
    }];
2. Need not any weather icon, SmileWeather handle it for you.

By using climacons font, the SmileWeatherData contains the corresponding character that is used for weather icon.

SmileWeatherData *data = ...;
UILabel *iconLabel = ...;

//current weather condition
iconLabel.text = data.currentData.icon;

3. Fully localized the related information for almost all the countries in the world.

The weather information, timestamp, weekday, timezone, etc, localized all the related information as much as possible.

4. Support Today Extension & WatchOS 2.

5. Add the Weather Widget Style UI to your project simply, by using SmileWeatherDemoVC.

Please check the example project for more detail.

SmileWeatherDemoVC *demoVC = [SmileWeatherDemoVC DemoVCToView:self.containerView];

#Theoretical Introduction

The main class is the SmileWeatherDownLoader. It handle downloading weather data from the Wunderground server. It has three main method:

/*!Get weather data from CLPlacemark.*/
-(void)getWeatherDataFromPlacemark:(CLPlacemark*)placeMark completion:(SmileWeatherDataDownloadCompletion)completion;

/*!Get weather data from CLLocation.*/
-(void)getWeatherDataFromLocation:(CLLocation*)location completion:(SmileWeatherDataDownloadCompletion)completion;

/*!Get array of CLPlacemark from the input string.*/
-(void)getPlacemarksFromString:(NSString*)string completion:(SmileWeatherPlacemarksCompletion)completion;

In the SmileWeatherDataDownloadCompletion block, SmileWeatherData is returned, it contains the current weather data, 4 days forecast data, 24 hourly forecast data, etc.

[[SmileWeatherDownLoader sharedDownloader] getWeatherDataFromPlacemark:placemark completion:^(SmileWeatherData *data, NSError *error) {
        if (!error) {
            NSLog(@"Current Temperature, Celsius : %@, Fahrenheit: %@", data.currentData.currentTempStri_Celsius, data.currentData.currentTempStri_Fahrenheit);
        }
    }];

SmileWeatherData also conform to NSCoding, you can archive it as NSData.

SmileWeatherData *data = ...
NSData* encodedData = [NSKeyedArchiver archivedDataWithRootObject: data];

#How to use it for your project?

Step 1. SmileWeather is available through use CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SmileWeather'

Or you can drag the SmileWeather folder to your project.

Step 2. Sign up Wunderground or Openweathermap to get the api key.

Step 3. Follow as the below image, add the api key and climacons font to your project's Info.plist.

If you use Wunderground api, please add this key: API_KEY_wunderground .

If you use Openweathermap api, please add this key: API_KEY_openweathermap.

If you add both of these in Info.plist, please add API_NOW to let the SmileWeather know which one should be used, 0 is API_KEY_wunderground, and 1 is API_KEY_openweathermap.

Step 4. The last step is that import SmileWeatherDownLoader.h to your project, and use it :)

Contributions

  • Warmly welcome to submit a pull request.

Contact

  • If you have some advice or find some issue, please contact me.
  • Email me

Thanks

Thanks for Comyar Zaheri's Sol° for iOS, I am inspired by this project.

Thanks for climacons font.

License

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

You might also like...
An Alamofire extension which converts JSON response data into swift objects using EVReflection

AlamofireJsonToObjects 🚨 This is now a subspec of EVReflection and the code is maintained there. 🚨 You can install it as a subspec like this: use_fr

SwiftCANLib is a library used to process Controller Area Network (CAN) frames utilizing the Linux kernel open source library SOCKETCAN.

SwiftCANLib SwiftCANLib is a library used to process Controller Area Network (CAN) frames utilizing the Linux kernel open source library SOCKETCAN. Th

Easy to use OAuth 2 library for iOS, written in Swift.
Easy to use OAuth 2 library for iOS, written in Swift.

Heimdallr Heimdallr is an OAuth 2.0 client specifically designed for easy usage. It currently supports the resource owner password credentials grant f

A lightweight, one line setup, iOS / OSX network debugging library! 🦊
A lightweight, one line setup, iOS / OSX network debugging library! 🦊

Netfox provides a quick look on all executed network requests performed by your iOS or OSX app. It grabs all requests - of course yours, requests from

Swift based OAuth library for iOS
Swift based OAuth library for iOS

OAuthSwift Swift based OAuth library for iOS and macOS. Support OAuth1.0, OAuth2.0 Twitter, Flickr, Github, Instagram, Foursquare, Fitbit, Withings, L

🏇 A Swift HTTP / HTTPS networking library just incidentally execute on machines
🏇 A Swift HTTP / HTTPS networking library just incidentally execute on machines

Thus, programs must be written for people to read, and only incidentally for machines to execute. Harold Abelson, "Structure and Interpretation of Com

A simple OAuth library for iOS with a built-in set of providers
A simple OAuth library for iOS with a built-in set of providers

SwiftyOAuth is a small OAuth library with a built-in set of providers and a nice API to add your owns. let instagram: Provider = .instagram(clientID:

Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.

Why Zewo? • Support • Community • Contributing Zewo Zewo is a lightweight library for web applications in Swift. What sets Zewo apart? Zewo is not a w

A lightweight library for writing HTTP web servers with Swift

Taylor Disclaimer: Not actively working on it anymore. You can check out some alternatives Swift 2.0 required. Working with Xcode 7.1. Disclaimer: It

Comments
Releases(0.2.4)
Owner
Rain
Design X Develop
Rain
A utility used to parse number strings

NumberParser is a Swift package used to parse number strings, e.g. "eight thousa

Dalton Claybrook 4 Dec 28, 2021
Setup your class structure in Xcode Interface Builder and save() in Parse Server.

ISParseBind With ISParseBind you can save, update and query PFObjects using the power of Xcode Interface Builder resources. https://www.youtube.com/wa

Weni 10 Mar 28, 2022
Layer + Parse iOS Example (Swift)

Note: I no longer actively working on this project. If you encounter any problem, please open an issue and hopefully the community will help out. If y

Kien 119 Feb 10, 2022
To practice URLSession to fetch json data from open weather API

⛅️ weatherApp-iOS-practice ?? 기능 상세 도시 이름을 입력하면 현재 날씨 정보를 가져와 화면에 표시되게 만들어야 합니다

Jacob Ko 0 Dec 18, 2021
ServiceData is an HTTP networking library written in Swift which can download different types of data.

ServiceData Package Description : ServiceData is an HTTP networking library written in Swift which can download different types of data. Features List

Mubarak Alseif 0 Nov 11, 2021
📱📲 A wrapper for the MultipeerConnectivity framework for automatic offline data transmission between devices

A wrapper for Apple's MultipeerConnectivity framework for offline data transmission between Apple devices. This framework makes it easy to automatical

Wilson Ding 197 Nov 2, 2022
Swift Paging is a framework that helps you load and display pages of data from a larger dataset from local storage or over network.

Swift Paging is a framework that helps you load and display pages of data from a larger dataset from local storage or over network. This approach allows your app to use both network bandwidth and system resources more efficiently. It's built on top of Combine, allowing you to harness its full power, handle errors easily, etc.

Gordan Glavaš 12 Dec 9, 2022
Swift-multipart-formdata - MultipartFormData: Build multipart/form-data type-safe in Swift

MultipartFormData Build multipart/form-data type-safe in Swift. A result builder

Felix Herrmann 21 Dec 29, 2022
Open source SDK to quickly integrate subscriptions, stop worring about code maintenance, and getting advanced real-time data. Javascript / iOS glue framework

Open source SDK to quickly integrate subscriptions, stop worring about code maintenance, and getting advanced real-time data. Javascript / iOS glue framework

glassfy 5 Nov 7, 2022
iOS 15, MVVM, Async Await, Core Data, Abstract Network Layer, Repository & DAO design patterns, SwiftUI and Combine

iOS 15, MVVM, Async Await, Core Data, Abstract Network Layer, Repository & DAO design patterns, SwiftUI and Combine

Conrado Mateu Gisbert 18 Dec 23, 2022