{"id":16685555,"url":"https://github.com/imryan/newsapi","last_synced_at":"2026-05-18T13:05:08.350Z","repository":{"id":62456609,"uuid":"286137521","full_name":"imryan/NewsAPI","owner":"imryan","description":"🗞️ Swift wrapper for the News API v2.","archived":false,"fork":false,"pushed_at":"2020-08-16T21:16:39.000Z","size":1520,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-22T22:47:45.465Z","etag":null,"topics":["news","newsapi","newsapi-org","swift"],"latest_commit_sha":null,"homepage":"https://newsapi.org/","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/imryan.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":"2020-08-08T23:57:31.000Z","updated_at":"2023-05-27T15:18:57.000Z","dependencies_parsed_at":"2022-11-02T00:16:58.782Z","dependency_job_id":null,"html_url":"https://github.com/imryan/NewsAPI","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imryan%2FNewsAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imryan%2FNewsAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imryan%2FNewsAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imryan%2FNewsAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imryan","download_url":"https://codeload.github.com/imryan/NewsAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243428434,"owners_count":20289317,"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":["news","newsapi","newsapi-org","swift"],"created_at":"2024-10-12T14:47:37.754Z","updated_at":"2025-12-29T13:28:34.142Z","avatar_url":"https://github.com/imryan.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](Screenshots/news-api-logo.png)\n\n# NewsAPI\n\n[![Version](https://img.shields.io/cocoapods/v/NewsAPI.svg?style=flat)](https://cocoapods.org/pods/NewsAPI)\n[![License](https://img.shields.io/cocoapods/l/NewsAPI.svg?style=flat)](https://cocoapods.org/pods/NewsAPI)\n[![Platform](https://img.shields.io/cocoapods/p/NewsAPI.svg?style=flat)](https://cocoapods.org/pods/NewsAPI)\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n![](Screenshots/list.png)\n![](Screenshots/detail.png)\n\n## Usage\n\n#### Initialization\n\u003e Setup with your API key first.\n\n```swift\nlet news: News = News(apiKey: \"your-api-key\")\n```\n\n#### Fetch top headlines\n\u003e Returns breaking news headlines for a country and category, or currently running on a single or multiple sources.\n\n\n```swift\nlet options: [QueryOptions] = [\n    .country(.us),\n    .pageSize(5),\n    .sortBy(.popularity)\n]\n        \nnews.get(.topHeadlines, with: options, headlinesCompletion: { [weak self] (headlines, error) in\n    if let headlines = headlines, let articles = headlines.articles {\n\tdebugPrint(articles)\n    }\n})\n\n```\n\n#### Fetch everything\n\u003e The NewsAPI indexes every recent news and blog article published by over 50,000 different sources large and small, and you can search through them with this endpoint.\n\n```swift\nlet options: [QueryOptions] = [\n    .domains([\"bbc.co.uk\", \"bbc.com\"]),\n    .excludeDomains([\"google.com\"]),\n    .country(.us)\n]\n        \nnews.get(.everything, with: options, headlinesCompletion: { [weak self] (headlines, error) in\n    if let headlines = headlines, let articles = headlines.articles {\n\tdebugPrint(articles)\n    }\n})\n\n```\n\n#### Fetch sources\n\u003e Returns information (including name, description, and category) about the most notable sources the NewsAPI indexes.\n\n```swift\nlet options: [QueryOptions] = [\n    .language(.en),\n    .category(.technology),\n    .country(.us)\n]\n        \nnews.get(.sources, with: options, sourcesCompletion: { [weak self] (sources, error) in\n    if let sources = sources {\n\tdebugPrint(sources)\n    }\n})\n\n```\n\n#### Query Options\n\u003e The available query options for filtering results.\n\n```swift\n/// Keywords or a phrase to search for.\ncase query(String)\n\n/// Keywords or phrases to search for in the article title only.\ncase titleQuery(String)\n\n/// The news sources or blogs you want headlines from.\ncase sources([String])\n\n/// Domains (eg bbc.co.uk, techcrunch.com, engadget.com) to restrict the search to.\ncase domains([String])\n\n/// Domains (eg bbc.co.uk, techcrunch.com, engadget.com) to remove from the results.\ncase excludeDomains([String])\n\n/// A date and optional time for the oldest article allowed.\ncase fromDate(Date)\n\n/// A date and optional time for the newest article allowed.\ncase toDate(Date)\n\n/// Code of the language you want to get headlines for.\ncase language(Language)\n\n/// The order to sort the articles in.\ncase sortBy(SortOptions)\n\n/// The category you want to get headlines for.\ncase category(Category)\n\n/// The code of the country you want to get headlines for.\ncase country(Country)\n\n/// The number of results to return per page (request). 20 is the default, 100 is the maximum.\ncase pageSize(Int)\n\n/// Use this to page through the results if the total results found is greater than the page size.\ncase page(Int)\n```\n\n## Installation\n\nNewsAPI is available through [CocoaPods](https://cocoapods.org/pods/SwiftNewsAPI). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'SwiftNewsAPI'\n```\n\n## Author\n\nimryan, notryancohen@gmail.com\n\n## License\n\nNewsAPI 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%2Fimryan%2Fnewsapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimryan%2Fnewsapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimryan%2Fnewsapi/lists"}