JSONFeed parser for swift

Related tags

JSON swift json jsonfeed
Overview

Build Status Codecov Carthage compatible SwiftPM Compatible

JSONFeed

Swift parsing for JSON Feed Spec

Installation

Carthage

You can install Carthage with Homebrew using the following command:

brew update
brew install carthage

To integrate JSONFeed into your Xcode project using Carthage, specify it in your Cartfile where "x.x.x" is the current release:

github "wesbillman/JSONFeed" "x.x.x"

Swift Package Manager

To install using Swift Package Manager have your Swift package set up, and add JSONFeed as a dependency to your Package.swift.

dependencies: [
    .Package(url: "https://github.com/wesbillman/JSONFeed.git", majorVersion: 0)
]

Manually

Add all the files from JSONFeed/JSONFeed to your project

Usage

See JSONFeedTests for detailed usage examples

Load a feed from a dictionary

let dictionary = <some feed dictionary>
let feed = try? JSONFeed(json: dictionary)

Load a feed from data

let data = <some feed data>
let feed = try? JSONFeed(data: data)

Load a feed from a json ut8f string

let string = <some utf8 json string>
let feed = try? JSONFeed(string: string)

Reading from a feed via URLSession

Using default configuration and URLSession

let reader = JSONFeedReader()
reader.read(string: "https://jsonfeed.org/feed.json") { (feed, error) in
    if let error = error {
        //bad things happened
    }

    if let feed = feed {
        //good things happened
    }
}

Using custom implemenation of URLSession (example: for unit testing)

let reader = JSONFeedReader(session: SomeCustomURLSession)
reader.read(string: "https://jsonfeed.org/feed.json") { (feed, error) in
    if let error = error {
        //bad things happened
    }

    if let feed = feed {
        //good things happened
    }
}
You might also like...
Implement dynamic JSON decoding within the constraints of Swift's sound type system by working on top of Swift's Codable implementations.

DynamicCodableKit DynamicCodableKit helps you to implement dynamic JSON decoding within the constraints of Swift's sound type system by working on top

AlamofireObjectMappe - An Alamofire extension which converts JSON response data into swift objects using ObjectMapper

AlamofireObjectMapper An extension to Alamofire which automatically converts JSON response data into swift objects using ObjectMapper. Usage Given a U

Decodable Simple and strict, yet powerful object mapping made possible by Swift 2's error handling.

Decodable Simple and strict, yet powerful object mapping made possible by Swift 2's error handling. Greatly inspired by Argo, but without a bizillion

Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable

Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable. Elevate should no longer be used for

Freddy - A reusable framework for parsing JSON in Swift.
Freddy - A reusable framework for parsing JSON in Swift.

Why Freddy? Parsing JSON elegantly and safely can be hard, but Freddy is here to help. Freddy is a reusable framework for parsing JSON in Swift. It ha

[Deprecated] A shiny JSON parsing library in Swift :sparkles: Loved by many from 2015-2021
[Deprecated] A shiny JSON parsing library in Swift :sparkles: Loved by many from 2015-2021

🚨 Deprecation Notice 🚨 Gloss has been deprecated in favor of Swift's Codable framework. The existing Gloss source is not going away, however updates

HandyJSON is a framework written in Swift which to make converting model objects to and from JSON easy on iOS.

HandyJSON To deal with crash on iOS 14 beta4 please try version 5.0.3-beta HandyJSON is a framework written in Swift which to make converting model ob

Himotoki (紐解き) is a type-safe JSON decoding library written purely in Swift.

Himotoki Himotoki (紐解き) is a type-safe JSON decoding library written purely in Swift. This library is highly inspired by the popular Swift JSON parsin

JASON is a faster JSON deserializer written in Swift.
JASON is a faster JSON deserializer written in Swift.

JASON is a faster JSON deserializer written in Swift. JASON is the best framework we found to manage JSON at Swapcard. This is by far the fastest and

Comments
  • Modernize code

    Modernize code

    Updated the code to work with Xcode 12 beta 4 and current version of Swift Package Manager. (Not sure about other build tools. I only need SPM myself.)

    opened by jaanus 1
Releases(0.0.2)
Owner
Wes
Wes
Swift parser for JSON Feed — a new format similar to RSS and Atom but in JSON.

JSONFeed Swift parser for JSON Feed — a new format similar to RSS and Atom but in JSON. For more information about this new feed format visit: https:/

Toto Tvalavadze 31 Nov 22, 2021
Jay - Pure-Swift JSON parser & formatter. Fully streamable input and output. Linux & OS X ready.

Pure-Swift JSON parser & formatter. Fully streamable input and output. Linux & OS X ready. Replacement for NSJSONSerialization.

Danielle 132 Dec 5, 2021
Functional JSON Parser - Linux Ready

Functional JSON Parser Feature Linux Ready Type-safe JSON parsing Functional value transformation Easy to parse nested value Dependency free No define

Ryo Aoyama 117 Sep 9, 2022
A sweet and swifty YAML parser built on LibYAML.

Yams A sweet and swifty YAML parser built on LibYAML. Installation Building Yams requires Xcode 11.x or a Swift 5.1+ toolchain with the Swift Package

JP Simard 930 Jan 4, 2023
This framework implements a strict JSON parser and generator in Objective-C.

SBJson 5 Chunk-based JSON parsing and generation in Objective-C. Overview SBJson's number one feature is stream/chunk-based operation. Feed the parser

null 3.8k Jan 5, 2023
A lightweight CSS parser for parsing and creating CSS stylesheets

SwiftCSSParser A lightweight CSS parser for Swift that uses cssparser (cpp) under the hood. Basic usage Here's a simple code snippet to get you starte

null 9 Jul 20, 2022
JSEN (JSON Swift Enum Notation) is a lightweight enum representation of a JSON, written in Swift.

JSEN /ˈdʒeɪsən/ JAY-sən JSEN (JSON Swift Enum Notation) is a lightweight enum representation of a JSON, written in Swift. A JSON, as defined in the EC

Roger Oba 8 Nov 22, 2022
Command line tool written in Swift dedicated to perform Mutation Testing of your Swift project

Mutanus Command line tool written in Swift dedicated to perform Mutation Testing of your Swift project. Inspired by Muter Usage mutanus -c <path-to-co

Iurii Sorokin 36 Sep 21, 2022
Swift-json - High-performance json parsing in swift

json 0.1.4 swift-json is a pure-Swift JSON parsing library designed for high-per

kelvin 43 Dec 15, 2022
Codable code is a Swift Package that allows you to convert JSON Strings into Swift structs

Codable code is a Swift Package that allows you to convert JSON Strings into Swift structs.

Julio Cesar Guzman Villanueva 2 Oct 6, 2022