Swiftpack.co -  thecatalinstan/CSFeedKit as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
An RSS feed generator and parser library for macOS. Swift and Objective-C compatible.
.package(url: "https://github.com/thecatalinstan/CSFeedKit.git", from: "1.0.0")

Version Status Platform Carthage compatible MIT License


An RSS feed generator and parser for macOS. Swift and Objective-C compatible.


You can install by either cloning the repo directy and adding the included project or by using one of the package managers, as described below.

Swift Package Manager

Add the package to your project's dependencies. If you have a Package.swift, it should look similar to this:

dependencies: [
    .package(name: "CSFeedKit", url: "https://github.com/thecatalinstan/CSFeedKit", from: "1.0.0"),

Install using CocoaPods by adding this line to your Podfile:


target 'MyApp' do
    pod 'CSFeedKit'

Creating an RSS Feed

The example below creates an RSS feed and prints the resulting XML string.

// Create a channel
let channel = CSRSSFeedChannel.init(title: "My RSS feed", link: "http://my.rss.feed/", description: "My first CSFeedKit RSS feed")
channel.category = "Examples"

// Add two items to the channel
var items = Array<CSRSSFeedItem>()
items.append(CSRSSFeedItem(title: "Item 1" , link: "http://my.rss.feed/item1", description: "The coolest item so far."))
items.append(CSRSSFeedItem(title: "Item 2" , link: "http://my.rss.feed/item2", description: "An even cooler item."))
channel.items = items

// Create the feed
let feed = CSRSSFeed()

// Add the channel to the feed
feed.channels = [channel]

// Output the XML
print(feed.xmlElement().xmlString(options: .nodePrettyPrint))

Parsing an RSS feed

The following prints out the titles and URLs of the items in the Hacker News RSS feed.

// Get the XML string (don't do it like this in the real-world ;) )
let xmlString = try String(contentsOf: URL(string: "https://news.ycombinator.com/rss")!)

// Init the feed
let feed = try CSRSSFeed(xmlString: xmlString)

// Print channel info
let channel = feed.channels[0]
print("channel: \(channel.title) - \(channel.pubDate ?? Date.distantPast)")

// Print the items
for item in channel.items {
    print(" * \(item.pubDate ?? Date.distantPast) - \(item.title) (\(item.link))")

What’s Next

Run the built-in example: https://github.com/thecatalinstan/CSFeedKit/blob/master/CSFeedKitExamples/CSFeedKitExamples/main.swift

Check out the complete documentation on CocoaDocs.


Stars: 3
Last commit: 6 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

6 weeks ago

Released on Tuesday, June 22, 2021.

This release adds support for the Swift Package Manager. It also updates the projects to Xcode 12.5 recommended build settings. Minimum macOS version is now 10.9, mainly for Xcode 12 compatibility, should still work fine on macOS >= 10.7.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API