Skip to content
/ FeedKit Public
forked from nmdias/FeedKit

An RSS, Atom and JSON Feed parser written in Swift

License

Notifications You must be signed in to change notification settings

sebj/FeedKit

 
 

Repository files navigation

FeedKit

build status language swift

Features

Basic Usage

Create a FeedParser and provide with Data or an InputStream, that represents an Atom, JSON, or RSS feed:

let parser = FeedParser(data: data) // or FeedParser(xmlStream: stream)

Then call parse to start parsing the feed:

let result = parser.parse()

FeedKit returns a Result<Feed, ParserError>, and as such, if parsing succeeds you should now have a strongly-typed model of an RSS, Atom or JSON Feed, within the Feed enum:

switch result {
case .success(let feed):
    
    // Get the parsed feed directly as an optional Atom, JSON, or RSS feed object
    feed.atomFeed
    feed.jsonFeed
    feed.rssFeed
    
    // Or alternatively...
    switch feed {
    case let .atom(feed):       // Atom Syndication Format Feed Model
    case let .json(feed):       // JSON Feed Model
    case let .rss(feed):        // Really Simple Syndication Feed Model
    }
    
case .failure(let error):
    print(error)
}

Installation

Swift Package Manager (Xcode):

  1. From the File menu, select Add Packages…
  2. Enter "https://github.com/sebj/FeedKit" into the package repository URL text field

Swift Package Manager (standalone):

Add the following to the dependencies of your Package.swift file:

.package(url: "https://github.com/sebj/FeedKit.git", ...)

License

This library is released under the MIT license. See LICENSE for details.

About

An RSS, Atom and JSON Feed parser written in Swift

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages

  • Swift 99.7%
  • C 0.3%