diff --git a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionViewModel.swift b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionViewModel.swift index 1a9f49f61..1602d0421 100644 --- a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionViewModel.swift @@ -164,9 +164,10 @@ public class ShareExtensionViewModel: ObservableObject { updateStatusOnMain(requestId: newRequestID, newStatus: .synced) // Prefetch the newly saved content - if let itemID = newRequestID, - let currentViewer = services.dataService.currentViewer?.username, - (try? await services.dataService.loadArticleContentWithRetries(itemID: itemID, username: currentViewer)) != nil + if + let itemID = newRequestID, + let currentViewer = services.dataService.currentViewer?.username, + (try? await services.dataService.loadArticleContentWithRetries(itemID: itemID, username: currentViewer)) != nil { updateStatusOnMain(requestId: requestId, newStatus: .synced, objectID: linkedItemObjectID) } diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift index 919d858f1..c1489b2cd 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift @@ -128,9 +128,10 @@ import Views } // If possible start prefetching new pages in the background - if let itemIDs = syncResult?.updatedItemIDs, - let username = dataService.currentViewer?.username, - itemIDs.count > 0 + if + let itemIDs = syncResult?.updatedItemIDs, + let username = dataService.currentViewer?.username, + !itemIDs.isEmpty { Task.detached(priority: .background) { await dataService.prefetchPages(itemIDs: itemIDs, username: username) diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsMasonaryView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsMasonaryView.swift index 7c36ff6c5..65c53faa6 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsMasonaryView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsMasonaryView.swift @@ -17,10 +17,11 @@ struct LabelsMasonaryView: View { @State private var totalHeight = CGFloat.zero private var labelItems: [(label: LinkedItemLabel, selected: Bool)] - init(labels allLabels: [LinkedItemLabel], - selectedLabels: [LinkedItemLabel], - onLabelTap: @escaping (LinkedItemLabel, TextChip) -> Void) - { + init( + labels allLabels: [LinkedItemLabel], + selectedLabels: [LinkedItemLabel], + onLabelTap: @escaping (LinkedItemLabel, TextChip) -> Void + ) { self.onLabelTap = onLabelTap let selected = selectedLabels.map { (label: $0, selected: true) } diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift index bd6a1cc26..7d3ca406c 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift @@ -554,10 +554,11 @@ struct WebReaderContainerView: View { func scrollToTop() {} func openOriginalURL(urlString: String?) { - if let urlString = urlString, - let url = URL(string: urlString) - { - openURL(url) - } + guard + let urlString = urlString, + let url = URL(string: urlString) + else { return } + + openURL(url) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift index 24d1b0c3f..b3c5065ff 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift @@ -192,10 +192,11 @@ struct SafariWebLink: Identifiable { } } - func setLabelsForHighlight(highlightID: String, - labelIDs: [String], - dataService: DataService) - { + func setLabelsForHighlight( + highlightID: String, + labelIDs: [String], + dataService: DataService + ) { dataService.setLabelsForHighlight(highlightID: highlightID, labelIDs: labelIDs) } diff --git a/apple/OmnivoreKit/Sources/Models/PageScrapePayload.swift b/apple/OmnivoreKit/Sources/Models/PageScrapePayload.swift index aafd4eb4c..28004ce07 100644 --- a/apple/OmnivoreKit/Sources/Models/PageScrapePayload.swift +++ b/apple/OmnivoreKit/Sources/Models/PageScrapePayload.swift @@ -13,9 +13,10 @@ public struct HighlightData { public let highlightText: String public static func make(dict: NSDictionary?) -> HighlightData? { - if let dict = dict, - let highlightHTML = dict["highlightHTML"] as? String, - let highlightText = dict["highlightText"] as? String + if + let dict = dict, + let highlightHTML = dict["highlightHTML"] as? String, + let highlightText = dict["highlightText"] as? String { return HighlightData(highlightHTML: highlightHTML, highlightText: highlightText) } diff --git a/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechPlayerItem.swift b/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechPlayerItem.swift index ac6d68a99..1f71cd6b0 100644 --- a/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechPlayerItem.swift +++ b/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechPlayerItem.swift @@ -84,9 +84,10 @@ class SpeechPlayerItem: AVPlayerItem { var pendingRequests = Set() weak var owner: SpeechPlayerItem? - func resourceLoader(_: AVAssetResourceLoader, - shouldWaitForLoadingOfRequestedResource loadingRequest: AVAssetResourceLoadingRequest) -> Bool - { + func resourceLoader( + _: AVAssetResourceLoader, + shouldWaitForLoadingOfRequestedResource loadingRequest: AVAssetResourceLoadingRequest + ) -> Bool { if owner == nil { return true } diff --git a/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechSynthesizer.swift b/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechSynthesizer.swift index bd6fe5228..c2ba01b41 100644 --- a/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechSynthesizer.swift +++ b/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechSynthesizer.swift @@ -195,10 +195,11 @@ struct SpeechSynthesizer { } } - static func download(speechItem: SpeechItem, - redownloadCached: Bool = false, - session: URLSession = URLSession.shared) async throws -> SynthesizeData? - { + static func download( + speechItem: SpeechItem, + redownloadCached: Bool = false, + session: URLSession = URLSession.shared + ) async throws -> SynthesizeData? { let decoder = JSONDecoder() if !redownloadCached { diff --git a/apple/OmnivoreKit/Sources/Services/InternalModels/InternalRecommendation.swift b/apple/OmnivoreKit/Sources/Services/InternalModels/InternalRecommendation.swift index e74df7245..086b61a18 100644 --- a/apple/OmnivoreKit/Sources/Services/InternalModels/InternalRecommendation.swift +++ b/apple/OmnivoreKit/Sources/Services/InternalModels/InternalRecommendation.swift @@ -22,10 +22,11 @@ public struct InternalRecommendation { public static func make(_ recommendations: NSSet?) -> [InternalRecommendation] { recommendations? .compactMap { recommendation in - if let recommendation = recommendation as? Recommendation, - let groupID = recommendation.groupID, - let name = recommendation.name, - let recommendedAt = recommendation.recommendedAt + if + let recommendation = recommendation as? Recommendation, + let groupID = recommendation.groupID, + let name = recommendation.name, + let recommendedAt = recommendation.recommendedAt { return InternalRecommendation( groupID: groupID, diff --git a/apple/OmnivoreKit/Sources/Services/InternalModels/InternalRecommendationGroup.swift b/apple/OmnivoreKit/Sources/Services/InternalModels/InternalRecommendationGroup.swift index b81b82181..27506ff2b 100644 --- a/apple/OmnivoreKit/Sources/Services/InternalModels/InternalRecommendationGroup.swift +++ b/apple/OmnivoreKit/Sources/Services/InternalModels/InternalRecommendationGroup.swift @@ -36,9 +36,10 @@ public struct InternalRecommendationGroup: Identifiable { } public static func make(from recommendationGroup: RecommendationGroup) -> InternalRecommendationGroup? { - if let id = recommendationGroup.id, - let name = recommendationGroup.name, - let inviteUrl = recommendationGroup.inviteUrl + if + let id = recommendationGroup.id, + let name = recommendationGroup.name, + let inviteUrl = recommendationGroup.inviteUrl { return InternalRecommendationGroup( id: id, diff --git a/apple/OmnivoreKit/Sources/Services/InternalModels/InternalUserProfile.swift b/apple/OmnivoreKit/Sources/Services/InternalModels/InternalUserProfile.swift index 226ca3c31..fa1a8b482 100644 --- a/apple/OmnivoreKit/Sources/Services/InternalModels/InternalUserProfile.swift +++ b/apple/OmnivoreKit/Sources/Services/InternalModels/InternalUserProfile.swift @@ -43,37 +43,39 @@ public struct InternalUserProfile: Identifiable, Encodable { } public static func makeSingle(_ user: UserProfile?) -> InternalUserProfile? { - if let user = user, - let userID = user.userID, - let name = user.name, - let username = user.username - { - return InternalUserProfile( - userID: userID, - name: name, - username: username, - profileImageURL: user.profileImageURL - ) + guard + let user = user, + let userID = user.userID, + let name = user.name, + let username = user.username + else { + return nil } - return nil + return InternalUserProfile( + userID: userID, + name: name, + username: username, + profileImageURL: user.profileImageURL + ) } public static func make(_ users: NSSet?) -> [InternalUserProfile] { users? .compactMap { user in - if let user = user as? UserProfile, - let userID = user.userID, - let name = user.name, - let username = user.username - { - return InternalUserProfile( - userID: userID, - name: name, - username: username, - profileImageURL: user.profileImageURL - ) + guard + let user = user as? UserProfile, + let userID = user.userID, + let name = user.name, + let username = user.username + else { + return nil } - return nil + return InternalUserProfile( + userID: userID, + name: name, + username: username, + profileImageURL: user.profileImageURL + ) } ?? [] } }