From f0034f8167aa8f5c2a40095d80ad42e75b7831fb Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Thu, 31 Mar 2022 22:15:22 -0700 Subject: [PATCH] swiftlint fixes --- .../Sources/App/Views/WebReader/WebReaderViewModel.swift | 7 ++----- apple/OmnivoreKit/Sources/Models/FeedItem.swift | 2 +- .../Services/DataService/Queries/ArticleContentQuery.swift | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift index 5764bac83..2afceda35 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift @@ -10,11 +10,8 @@ struct SafariWebLink: Identifiable { } func encodeHighlightResult(_ highlight: Highlight) -> [String: Any]? { - let data = try? JSONEncoder().encode(highlight) - if let data = data, let dictionary = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: Any] { - return dictionary - } - return nil + guard let data = try? JSONEncoder().encode(highlight) else { return nil } + return try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: Any] } final class WebReaderViewModel: ObservableObject { diff --git a/apple/OmnivoreKit/Sources/Models/FeedItem.swift b/apple/OmnivoreKit/Sources/Models/FeedItem.swift index af6a53139..6d716919b 100644 --- a/apple/OmnivoreKit/Sources/Models/FeedItem.swift +++ b/apple/OmnivoreKit/Sources/Models/FeedItem.swift @@ -70,8 +70,8 @@ public struct FeedItem: Identifiable, Hashable, Decodable { self.labels = labels } - // swiftlint:disable:next line_length enum CodingKeys: String, CodingKey { + // swiftlint:disable:next line_length case id, title, createdAt, savedAt, image, isArchived, readingProgressPercent, readingProgressAnchorIndex, slug, contentReader, url, labels } diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift b/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift index 4970c2330..8822a0d98 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift @@ -3,7 +3,6 @@ import Foundation import Models import SwiftGraphQL -// swiftlint:disable:next function_body_length public extension DataService { func articleContentPublisher(username: String, slug: String) -> AnyPublisher { enum QueryResult {