Complete reference for the FeedReaderCore Swift Package โ RSS parsing, models, and utilities.
Parses RSS XML feeds into RSSStory objects. Supports loading multiple feeds concurrently with O(1) deduplication by link URL. Thread-safe โ all shared state mutations are serialized on an internal serial queue.
| Property | Type | Description |
|---|---|---|
delegate | RSSParserDelegate? | Delegate notified when feed loading completes or fails |
stories | [RSSStory] | Read-only. Accumulated stories from all parsed feeds |
| Method | Description |
|---|---|
loadFeeds(_ urls: [String]) |
Parse stories from multiple feed URLs concurrently. Calls delegate on the main thread when all feeds complete. Cancels any in-flight load from a previous call. Stories are deduplicated by link URL. |
parseData(_ data: Data) โ [RSSStory] |
Parse stories from in-memory XML data synchronously. Useful for testing and offline scenarios. Returns an array of parsed stories directly. |
Delegate protocol for receiving RSS parsing results. Callbacks are always delivered on the main thread.
| Method | Description |
|---|---|
parserDidFinishLoading(stories: [RSSStory]) |
Called when all requested feeds have finished loading. The stories array contains deduplicated results from all feeds. |
parserDidFailWithError(_ error: Error?) |
Called when a feed fails to load. The error may be nil for non-HTTP errors. |
Represents a single parsed RSS story with title, body, link, and optional image URL. Provides URL validation and HTML sanitization. Conforms to NSObject and Sendable.
| Property | Type | Description |
|---|---|---|
title | String | The story headline |
body | String | The story description with HTML tags stripped and entities decoded |
link | String | The story's unique URL (used for equality and deduplication) |
imagePath | String? | Optional thumbnail image URL (only set if URL passes safety validation) |
Returns nil if:
title is emptybody is empty after HTML strippinglink is not a valid HTTP/HTTPS URL| Method | Description |
|---|---|
isSafeURL(_ urlString: String?) โ Bool |
Validates that a URL uses only allowed schemes (http, https). Rejects javascript:, file:, data:, and other unsafe schemes. |
stripHTML(_ html: String) โ String |
Strips HTML tags via regex and decodes common HTML entities (&, <, >, ", ', ). |
Two RSSStory instances are equal if their link properties match. This is how deduplication works across multiple feeds.
Represents an RSS feed source with a name, URL, and enabled state. Conforms to NSSecureCoding for persistent storage and Sendable for thread safety.
| Property | Type | Description |
|---|---|---|
name | String | Display name for the feed |
url | String | RSS feed URL string |
isEnabled | Bool | Whether the feed is currently enabled for fetching |
identifier | String | Computed. Lowercased URL used for deduplication |
| Property | Description |
|---|---|
presets: [FeedItem] |
10 built-in feed sources: BBC World News, BBC Technology, BBC Science, BBC Business, NPR News, Reuters World, TechCrunch, Ars Technica, Hacker News, The Verge |
Provides a simple check for network connectivity using SystemConfiguration. Uses SCNetworkReachability to check for a default network route.
| Method | Description |
|---|---|
isConnected() โ Bool |
Returns true if the device currently has a network route available. Does not guarantee that a specific host is reachable โ only that the system believes a route exists. |