mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Switch to new Parser.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// FeedParser.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/20/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
@@ -50,6 +50,22 @@ public struct FeedParser {
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse(_ parserData: ParserData, _ completion: @Sendable @escaping (ParsedFeed?, Error?) -> Void) {
|
||||
|
||||
Task {
|
||||
do {
|
||||
let parsedFeed = try await parseAsync(urlString: parserData.url, data: parserData.data)
|
||||
Task { @MainActor in
|
||||
completion(parsedFeed, nil)
|
||||
}
|
||||
} catch {
|
||||
Task { @MainActor in
|
||||
completion(nil, error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static func parseAsync(urlString: String, data: Data) async throws -> ParsedFeed? {
|
||||
|
||||
try parse(urlString: urlString, data: data)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// FeedParserError.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/24/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// FeedType.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/20/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// JSONFeedParser.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/25/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// RSSInJSONParser.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/24/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// ParsedAttachment.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/20/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// ParsedAuthor.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/20/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// ParsedFeed.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/20/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// ParsedHub.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/20/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// ParsedItem.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/20/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// AtomParser.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/25/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// RSSFeedTransformer.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/25/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// RSSParser.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/25/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// JSONDictionary.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 6/24/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// JSONUtilities.swift
|
||||
// RSParser
|
||||
// Parser
|
||||
//
|
||||
// Created by Brent Simmons on 12/10/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// String+RSParser.swift
|
||||
// RSParser
|
||||
// String+Parser.swift
|
||||
// Parser
|
||||
//
|
||||
// Created by Nate Weaver on 2020-01-19.
|
||||
// Copyright © 2020 Ranchero Software, LLC. All rights reserved.
|
||||
|
||||
Reference in New Issue
Block a user