Skip to content

A RSS, Atom and JSON feeds parsing Swift package

License

Notifications You must be signed in to change notification settings

armartinez/swift-feeds

 
 

Repository files navigation

Swift Feeds

Swift Feeds is based on FeedKit. It's focused on simplicity, speed and support for later versions of Apple's devices.

Features

Requirements

xcode ios tvos watchos mac os

Usage

Build a URL pointing to a RSS, Atom or JSON Feed.

let feedURL = URL(string: "http://images.apple.com/main/rss/hotnews/hotnews.rss")!

And then get an instance of a RSSFeed, AtomFeed, or JSONFeed struct asynchronously.

let feed = try await AtomFeed(URL: feedURL) 

Alternatively, you can also parse synchronously if the URL is a local file or use a Data object.

let parser = try AtomFeed(URL: feedURL) // or AtomFeed(data: data) 

Model Preview

The RSS and Atom feed Models are rather extensive throughout the supported namespaces. These are just a preview of what's available.

RSS

feed.title
feed.link
feed.description
feed.language
feed.copyright
feed.managingEditor
feed.webMaster
feed.pubDate
feed.lastBuildDate
feed.categories
feed.generator
feed.docs
feed.cloud
feed.rating
feed.ttl
feed.image
feed.textInput
feed.skipHours
feed.skipDays
//...
feed.dublinCore
feed.syndication
feed.iTunes
// ...

let item = feed.items?.first

item?.title
item?.link
item?.description
item?.author
item?.categories
item?.comments
item?.enclosure
item?.guid
item?.pubDate
item?.source
//...
item?.dublinCore
item?.content
item?.iTunes
item?.media
// ...

Atom

feed.title
feed.subtitle
feed.links
feed.updated
feed.authors
feed.contributors
feed.id
feed.generator
feed.icon
feed.logo
feed.rights
// ...

let entry = feed.entries?.first

entry?.title
entry?.summary
entry?.authors
entry?.contributors
entry?.links
entry?.updated
entry?.categories
entry?.id
entry?.content
entry?.published
entry?.source
entry?.rights
// ...

JSON

feed.version
feed.title
feed.homePageURL
feed.feedUrl
feed.description
feed.userComment
feed.nextUrl
feed.icon
feed.favicon
feed.author
feed.expired
feed.hubs
feed.extensions
// ...

let item = feed.items?.first

item?.id
item?.url
item?.externalUrl
item?.title
item?.contentText
item?.contentHtml
item?.summary
item?.image
item?.bannerImage
item?.datePublished
item?.dateModified
item?.author
item?.url
item?.tags
item?.attachments
item?.extensions
// ...

License

Swift Feeds is released under the MIT license. See LICENSE for details.

About

A RSS, Atom and JSON feeds parsing Swift package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%