{"id":15293618,"url":"https://github.com/jolucama/openweathermapapiconsumer","last_synced_at":"2025-04-13T14:07:47.185Z","repository":{"id":62449651,"uuid":"77265752","full_name":"jolucama/OpenWeatherMapAPIConsumer","owner":"jolucama","description":"Free version API Consumer to get the current and forecast weather of Open Weather Map","archived":false,"fork":false,"pushed_at":"2017-11-10T14:18:42.000Z","size":262,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T14:07:41.636Z","etag":null,"topics":["api-consumer","cocoapods","ios-lib","swift-3","weather"],"latest_commit_sha":null,"homepage":"https://cocoapods.org/pods/OpenWeatherMapAPIConsumer","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jolucama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-24T04:31:18.000Z","updated_at":"2023-10-10T08:10:10.000Z","dependencies_parsed_at":"2022-11-01T23:17:26.427Z","dependency_job_id":null,"html_url":"https://github.com/jolucama/OpenWeatherMapAPIConsumer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jolucama%2FOpenWeatherMapAPIConsumer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jolucama%2FOpenWeatherMapAPIConsumer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jolucama%2FOpenWeatherMapAPIConsumer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jolucama%2FOpenWeatherMapAPIConsumer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jolucama","download_url":"https://codeload.github.com/jolucama/OpenWeatherMapAPIConsumer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724636,"owners_count":21151561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-consumer","cocoapods","ios-lib","swift-3","weather"],"created_at":"2024-09-30T16:50:12.128Z","updated_at":"2025-04-13T14:07:47.152Z","avatar_url":"https://github.com/jolucama.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenWeatherMapAPIConsumer\n\nOpen Weather Map API Consumer fully \u003ca href=\"https://github.com/jolucama/OpenWeatherMapAPIConsumer/tree/master/Example/Tests\"\u003eUnit Tested\u003c/a\u003e, being able to get current weather and 3-hourly forecast 5 days for your city. Helpful stats, temperature, clouds, pressure, wind around your location... This API is a consumer of \u003ca href=\"https://openweathermap.org/\"\u003eOpen Weather Map\u003c/a\u003e and the description of the api may be found \u003ca href=\"https://openweathermap.org/api\"\u003ehere\u003c/a\u003e\n\nNote: In the consumer has been implemented just the free version of the API. In order to start using it, please register and get the API Key \u003ca href=\"https://openweathermap.org/price\"\u003eSign up\u003c/a\u003e\n\n[![Build Status](https://travis-ci.org/jolucama/OpenWeatherMapAPIConsumer.svg?branch=master)](https://travis-ci.org/jolucama/OpenWeatherMapAPIConsumer)\n[![Version](https://img.shields.io/cocoapods/v/OpenWeatherMapAPIConsumer.svg?style=flat)](http://cocoapods.org/pods/OpenWeatherMapAPIConsumer)\n[![License](https://img.shields.io/cocoapods/l/OpenWeatherMapAPIConsumer.svg?style=flat)](http://cocoapods.org/pods/OpenWeatherMapAPIConsumer)\n[![Platform](https://img.shields.io/cocoapods/p/OpenWeatherMapAPIConsumer.svg?style=flat)](http://cocoapods.org/pods/OpenWeatherMapAPIConsumer)\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/jolucama/OpenWeatherMapAPIConsumer/blob/master/Example/OpenWeatherMapAPIConsumer/CurrentWeatherViewController.png\" width=\"300\"/\u003e\n    \u003cimg src=\"https://github.com/jolucama/OpenWeatherMapAPIConsumer/blob/master/Example/OpenWeatherMapAPIConsumer/ForecastWeatherViewController.png\" width=\"300\"/\u003e\n\u003c/p\u003e\n\nBasically, the example makes use of the CLLocationManager to obtain the current coordenates, and then make a request to our API to get all the displayed information. All the code is located in \u003ca href=\"https://github.com/jolucama/OpenWeatherMapAPIConsumer/blob/master/Example/OpenWeatherMapAPIConsumer/ViewController.swift\"\u003eView Controller\u003c/a\u003e\n\n## Requirements\n\n- iOS 10.2\n- Swift 3\n- Xcode 8\n\n## Installation\n\nOpenWeatherMapAPIConsumer is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"OpenWeatherMapAPIConsumer\"\n```\n## Usage\n\n### Import the pod in your file\n\n```swift\nimport OpenWeatherMapAPIConsumer\n```\n\n### Setup the api key\n\n```swift\n\n// Type by default OpenWeatherMapType.Current\nlet weatherAPI = OpenWeatherMapAPI(apiKey: \"YOUR_API_KEY\")\n\n// Type forecast\nlet weatherAPI = OpenWeatherMapAPI(apiKey: \"YOUR_API_KEY\", forType: OpenWeatherMapType.Forecast)\n\n```\n\n\n### Set the location using \n\n```swift\n\npublic func weather(byLatitude latitude : Double, andLongitude longitude : Double)\n\npublic func weather(byCityName cityName : String)\n\npublic func weather(byCityName cityName : String, andCountryCode countryCode: String)\n\n// List of city ids may be found here: http://bulk.openweathermap.org/sample/\npublic func weather(byCityId cityId : Int)\n\n```\n\n### API Options\n\n```swift\npublic func setSearchAccuracy(searchAccuracy : SearchAccuracyType)\n\npublic func setLimitationOfResult(in limitation : Int)\n\npublic func setTemperatureUnit(unit : TemperatureFormat)\n\npublic func setMultilingualSupport(language : Language)\n```\n\n### Perform request\n\n```swift\npublic func performWeatherRequest(completionHandler: @escaping (Data?, URLResponse?, Error?) -\u003e Swift.Void)\n\n//Example\nweatherAPI.performWeatherRequest(completionHandler:{(data: Data?, urlResponse: URLResponse?, error: Error?) in\n    if (error != nil) {\n        //Handling error\n    } else {\n        do {\n            let responseWeatherApi = try CurrentResponseOpenWeatherMap(data: data!)\n        } catch let error as Error {\n            //Handling error\n        }\n    }\n})\n\n```\n\n### Response classes\n\nThe response classes are parsers, that give you a better use of the api response\n\n- CurrentResponseOpenWeatherMap(data : Data)\n- ForecastResponseOpenWeatherMap(data : Data)\n\n```swift\n\nfunc getCoord() -\u003e CLLocationCoordinate2D\n\nfunc getTemperature() -\u003e Float\n\nfunc getPressure() -\u003e Float\n\nfunc getHumidity() -\u003e Float\n\nfunc getTempMax() -\u003e Float\n\nfunc getTempMin() -\u003e Float\n\nfunc getCityName() -\u003e String\n\nfunc getIconList() -\u003e IconList\n\nfunc getDescription() -\u003e String\n\nfunc getWindSpeed() -\u003e Float\n\nfunc getDate() -\u003e Date\n\n```\n\n## Author\n\nJose Luis Cardosa, jlcardosa@gmail.com\n\n## License\n\nOpenWeatherMapAPIConsumer is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjolucama%2Fopenweathermapapiconsumer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjolucama%2Fopenweathermapapiconsumer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjolucama%2Fopenweathermapapiconsumer/lists"}