An unofficial supported Swift client library for accessing News API.

Overview

NewsAPI

An API framework for newsapi.org with Swift.

Requirement

  • Swift5.5+

Installation

Swift Package Manager

.package(url: "https://github.com/mtfum/NewsAPI.git", from: "0.1.0")

Usage

Setup

import NewsAPI

let client = NewsAPI(apiKey: "YOUR_API_KEY")

Get Sources

let articles = try await client.getSources(
    sources: [String] = [], // abc-news, bbc-news, etc...
    query: String? = nil,
    category: NewsSourceCategory? = nil,
    language: Language = Language.en
)

Search

let articles = try await client.search(
  query: "",
  sources: [String] = [],
  sortBy: SortBy? = nil, // relevancy, popularity, publishedAt
  language: Language? = nil
)

Top-Headlines

let articles = try await client.getTopHeadlines(
  category: NewsSourceCategory? = nil,
  language: Language? = nil,
  country: Country? = nil
)
You might also like...
📡 RealHTTP is a lightweight yet powerful client-side HTTP library.
📡 RealHTTP is a lightweight yet powerful client-side HTTP library.

RealHTTP RealHTTP is a lightweight yet powerful client-side HTTP library. Our goal is make an easy to use and effortless http client for Swift. Featur

The HTTP library used by the Spotify iOS client
The HTTP library used by the Spotify iOS client

Authentication and back-off logic is a pain, let's do it once and forget about it! This is a library that allows you to centralise this logic and forg

Conforming WebSocket (RFC 6455) client library for iOS and Mac OSX
Conforming WebSocket (RFC 6455) client library for iOS and Mac OSX

SwiftWebSocket Conforming WebSocket (RFC 6455) client library for iOS and Mac OS

An awesome Swift HTTP library to rapidly create communication layers with API endpoints

An awesome Swift HTTP library to rapidly create communication layers with API endpoints

MQTTNIO - Non-blocking, event-driven Swift client for MQTT build on SwiftNIO

This library has support for WebSocket connections and TLS. It runs on all platforms Swift NIO runs on (e.g. macOS, iOS, Linux, etc.).

A barebones Swift HTTP client with automatic JSON response parsing.

HTTP Client A barebones Swift HTTP client with automatic JSON response parsing. Installation Add HTTP Client as a dependency through Xcode or directly

A simple GCD based HTTP client and server, written in 'pure' Swift
A simple GCD based HTTP client and server, written in 'pure' Swift

SwiftyHTTP Note: I'm probably not going to update this any further - If you need a Swift networking toolset for the server side, consider: Macro.swift

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.

Apollo iOS is a strongly-typed, caching GraphQL client, written in Swift. It allows you to execute queries and mutations against a GraphQL server, and

A swift client for interacting with NATS servers
A swift client for interacting with NATS servers

SwiftyNats A maintained swift client for interacting with a nats server based on NIO2. Tested with Swift 5.4 on and Swift Version Compatibility: Platf

Comments
  • Improving test cases

    Improving test cases

    Outline

    Improving test cases

    Reference

    • assert https://developer.apple.com/documentation/swift/1541112-assert
    • XCTAssert https://developer.apple.com/documentation/xctest/xctassert

    Thanks!

    opened by haptaro 1
Releases(0.2.0)
Owner
Fumiya Yamanaka
Fumiya Yamanaka
An iOS library to route API paths to objects on client side with request, mapping, routing and auth layers

WANetworkRouting Developed and Maintained by ipodishima Founder & CTO at Wasappli Inc. Sponsored by Wisembly A routing library to fetch objects from a

null 10 Nov 20, 2022
The official iOS client library for api.video

api.video iOS client api.video is the video infrastructure for product builders.

api.video 8 Dec 2, 2022
Twitter-Client - A twitter client that allow users to view tweets on their iphone

Project 3 - Twitter Client Name of your app is a basic twitter app to read your

null 0 Feb 7, 2022
A web API client in Swift built using Async/Await

Get A modern web API client in Swift built using Async/Await and Actors. let cli

Alexander Grebenyuk 745 Jan 3, 2023
NewsAppTask - News App Task for iOS

NewsAppTask The application is designed to view the news for the last 7 days fro

Mikhail Skuratov 0 Feb 6, 2022
Postie - The Next-Level HTTP API Client using Combine

Postie - The Next-Level HTTP API Client using Combine Postie is a pure Swift library for building URLRequests using property wrappers.

kula 28 Jul 23, 2022
TheraForge's Client REST API framework to connect to TheraForge's secure CloudBox Backend-as-a-Service (BaaS)

OTFCloudClientAPI TheraForge's Client REST API Framework to Connect to TheraForg

TheraForge 0 Dec 23, 2021
TMDB(The Movie Database) API client application.

TMDB Client App Instructions Instructions for project setup. 1. Clone the project. 2. Go to "TMDB Client App" folder location on terminal and enter "p

Muhammed Karakul 0 Dec 26, 2021
APIProvider - API Provider Package for easier API management inspired by abstraction

APIProvider Using APIProvider you can easily communicate with all API endpoints

null 1 Apr 21, 2022
A conforming Objective-C WebSocket client library.

SocketRocket A conforming WebSocket (RFC 6455) client library for iOS, macOS and tvOS. Test results for SocketRocket here. You can compare to what mod

Facebook Incubator 9.4k Dec 27, 2022