|
| 1 | +# swift-rss-standard |
| 2 | + |
| 3 | +[](https://github.com/swift-web-standards/swift-rss-standard/actions/workflows/ci.yml) |
| 4 | + |
| 5 | + |
| 6 | +Type-safe RSS 2.0 feed type definitions for Swift with support for iTunes podcast extensions and Dublin Core metadata. |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +swift-rss-standard provides complete RSS 2.0 specification support with type-safe Swift types for representing RSS feed data structures. Includes dedicated support for podcast feeds via iTunes extensions and metadata enrichment through Dublin Core. |
| 11 | + |
| 12 | +For RSS feed generation and parsing, see [swift-rss](https://github.com/coenttb/swift-rss). |
| 13 | + |
| 14 | +## Features |
| 15 | + |
| 16 | +- **Complete RSS 2.0 Support**: All required and optional channel and item elements per RSS 2.0 specification |
| 17 | +- **iTunes Podcast Extensions**: Full support for podcast-specific metadata (duration, episode type, season/episode numbers) |
| 18 | +- **Dublin Core Metadata**: Rich metadata support for creators, subjects, publishers |
| 19 | +- **Type Safety**: Compile-time validation with Hashable, Sendable, Codable conformance |
| 20 | +- **Validation**: Failable initializers enforce RSS requirements (items require title OR description) |
| 21 | +- **Swift 6.0 Concurrency**: Strict concurrency mode with complete Sendable conformance |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +Add swift-rss-standard to your Package.swift dependencies: |
| 26 | + |
| 27 | +```swift |
| 28 | +dependencies: [ |
| 29 | + .package(url: "https://github.com/swift-web-standards/swift-rss-standard", from: "0.1.0") |
| 30 | +] |
| 31 | +``` |
| 32 | + |
| 33 | +Then add the products you need to your target dependencies: |
| 34 | + |
| 35 | +```swift |
| 36 | +.target( |
| 37 | + name: "YourTarget", |
| 38 | + dependencies: [ |
| 39 | + .product(name: "RSS", package: "swift-rss-standard"), |
| 40 | + .product(name: "RSS iTunes", package: "swift-rss-standard"), // Optional: for podcast feeds |
| 41 | + .product(name: "RSS Dublin Core", package: "swift-rss-standard") // Optional: for metadata |
| 42 | + ] |
| 43 | +) |
| 44 | +``` |
| 45 | + |
| 46 | +## Quick Start |
| 47 | + |
| 48 | +```swift |
| 49 | +import RSS_Standard |
| 50 | + |
| 51 | +// Create a basic RSS feed model |
| 52 | +let channel = RSS.Channel( |
| 53 | + title: "My Blog", |
| 54 | + link: URL(string: "https://example.com")!, |
| 55 | + description: "A blog about Swift development", |
| 56 | + language: "en-US", |
| 57 | + items: [ |
| 58 | + try! RSS.Item( |
| 59 | + title: "First Post", |
| 60 | + description: "Hello, world!", |
| 61 | + link: URL(string: "https://example.com/post1")!, |
| 62 | + pubDate: Date() |
| 63 | + ) |
| 64 | + ] |
| 65 | +) |
| 66 | + |
| 67 | +// Use the model with swift-rss for XML generation/parsing |
| 68 | +// See: https://github.com/coenttb/swift-rss |
| 69 | +``` |
| 70 | + |
| 71 | +## Usage Examples |
| 72 | + |
| 73 | +### Podcast Feed with iTunes Extensions |
| 74 | + |
| 75 | +```swift |
| 76 | +import RSS_Standard |
| 77 | +import RSS_Standard_iTunes |
| 78 | + |
| 79 | +let channel = RSS.Channel( |
| 80 | + title: "My Podcast", |
| 81 | + link: URL(string: "https://example.com/podcast")!, |
| 82 | + description: "A podcast about technology", |
| 83 | + items: [ |
| 84 | + try! RSS.Item( |
| 85 | + title: "Episode 1: Getting Started", |
| 86 | + description: "In this episode we discuss...", |
| 87 | + link: URL(string: "https://example.com/episode1")!, |
| 88 | + pubDate: Date() |
| 89 | + ) |
| 90 | + ] |
| 91 | +) |
| 92 | + |
| 93 | +// Use with swift-rss for XML generation |
| 94 | +``` |
| 95 | + |
| 96 | +## Related Packages |
| 97 | + |
| 98 | +- [swift-rss](https://github.com/coenttb/swift-rss): RSS feed generation and parsing using these types |
| 99 | +- [swift-rfc-4287](https://github.com/swift-web-standards/swift-rfc-4287): Type-safe Atom feed generation and parsing for Swift (RFC 4287 implementation) |
| 100 | +- [swift-json-feed](https://github.com/swift-web-standards/swift-json-feed): Type-safe JSON Feed generation and parsing for Swift |
| 101 | +- [swift-syndication](https://github.com/coenttb/swift-syndication): Unified syndication API supporting RSS, Atom, and JSON Feed with format conversion |
| 102 | +- [swift-rfc-2822](https://github.com/swift-web-standards/swift-rfc-2822): RFC 2822 date formatting for email and RSS dates |
| 103 | + |
| 104 | +## License |
| 105 | + |
| 106 | +This project is licensed under the Apache License 2.0. See LICENSE for details. |
| 107 | + |
| 108 | +## Contributing |
| 109 | + |
| 110 | +Contributions are welcome! Please feel free to submit a Pull Request. |
0 commit comments