Skip to content

Commit

Permalink
cleanup documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
levitatingpineapple committed Jan 2, 2025
1 parent e5945fc commit a69e0d0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
14 changes: 6 additions & 8 deletions Core/Sources/Core/Documentation.docc/Articles/FetchingFeeds.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# Fetching Feeds

<!--toc:start-->
- [Fetching Feeds](#fetching-feeds)
- [Overview](#overview)
- [Parallel Fetch](#parallel-fetch)
- [Conditional Requests](#conditional-requests)
- [Additional Resources](#additional-resources)
<!--toc:end-->

Various Optimizations for fetching feeds

@Metadata {
Expand Down Expand Up @@ -48,3 +40,9 @@ Feeds often reference additional contents which can be handled separately:
- ``ContentExtractor`` Used to extract full article from URL.\
Useful for feeds that only include their abstract.

## Topics

### Integration

- ``Mapped``
- ``ConditionalHeaders``
5 changes: 0 additions & 5 deletions Core/Sources/Core/Documentation.docc/Articles/StoringFeeds.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ All foreign key references are set to cascade on delete.

## Topics

### Essentials

- <doc:FetchingFeeds>
- <doc:Syncing>

### Integration

- ``Store``
Expand Down
12 changes: 4 additions & 8 deletions Core/Sources/Core/Documentation.docc/Articles/Syncing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ The syncing between devices is handled by ``Sync`` using CloudKit's [`CKSyncEngi
While this first-party solution allows for sync without running a dedicated server there are few limitations:

- Due to iCloud [bandwidth limitations](https://github.com/Ranchero-Software/NetNewsWire/wiki/iCloud-Sync-and-NetNewsWire:-Where-We’re-Stuck) only user interactions such as `.isRead` and `.isStarred` are synced for each ``Item``
- Since [`CKRecord.Reference`](https://developer.apple.com/documentation/cloudkit/ckrecord/reference) only supports only up to **750** references per record,\
it can't be used to fully map ``Feed`` - ``Item`` relationships. The solution for this is to store each feed in it's own [`CKRecordZone`](https://developer.apple.com/documentation/cloudkit/ckrecordzone) mapping source of the ``Feed`` to the [`CKRecordZone.ID`](https://developer.apple.com/documentation/cloudkit/ckrecordzone/id). This way, when the feed gets deleted all of it's records are removed too.
- Since [`CKRecord.Reference`](https://developer.apple.com/documentation/cloudkit/ckrecord/reference) only supports up to **750** references per record,\
it can't be used to fully map ``Feed`` - ``Item`` relationships. The solution for this is to store each feed in its own [`CKRecordZone`](https://developer.apple.com/documentation/cloudkit/ckrecordzone) mapping source of the ``Feed`` to the [`CKRecordZone.ID`](https://developer.apple.com/documentation/cloudkit/ckrecordzone/id). This way, when the feed gets deleted all of its records are removed too.



Expand All @@ -27,18 +27,14 @@ it can't be used to fully map ``Feed`` - ``Item`` relationships. The solution fo
2. Add an identifier `com.mydomain.feedradar` to [App IDs](https://developer.apple.com/account/resources/identifiers/list) with following capabilities:
- **iCloud** (Include CloudKit support)
- **Push notifications**
3. After identifier has beed created, select it from the list and add the created container to the **iCloud** capability.
3. After identifier has been created, select it from the list and add the created container to the **iCloud** capability.
4. Generate a Provisioning Profile, download it and import into Xcode.

Now the project should build.

## Topics

### Essentials

- <doc:FetchingFeeds>
- <doc:StoringFeeds>

### Integration

- ``Sync``

16 changes: 13 additions & 3 deletions Core/Sources/Core/Store/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Foundation
import GRDB
import os.log

/// Empty composed protocol that defines requirement for types,
/// which are stored in the database. Conformed by ``Feed``, ``Item`` and ``Attachment``
public protocol Storable:
Hashable,
Identifiable,
Expand Down Expand Up @@ -38,6 +40,8 @@ public final class Store: Sendable {
}

// TODO: Refactor after swift 6 migration

/// Model for driving UI loading indicators
@MainActor
public class LoadingManager {
@Observable
Expand All @@ -48,11 +52,16 @@ public class LoadingManager {
// }
public var isLoading = false
}


/// Public Instance
public static let shared: LoadingManager = LoadingManager()

private var models = Dictionary<URL, Model>()


/// Creates and
///
/// - Parameter source: Feeds are identified by their source URL
/// - Returns: Observable loading model
public func model(source: URL) -> Model {
if let model = models[source] {
return model
Expand All @@ -61,10 +70,11 @@ public class LoadingManager {
return model(source: source)
}
}

func start(source: URL) {
model(source: source).isLoading = true
}


func stop(source: URL) {
model(source: source).isLoading = false
Expand Down

0 comments on commit a69e0d0

Please sign in to comment.