Create FeedParser target to replace Parser.
This commit is contained in:
parent
ec2c294fab
commit
61825a6d88
@ -18,9 +18,9 @@
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "ParserTests"
|
||||
BuildableName = "ParserTests"
|
||||
BlueprintName = "ParserTests"
|
||||
BlueprintIdentifier = "FeedParserTests"
|
||||
BuildableName = "FeedParserTests"
|
||||
BlueprintName = "FeedParserTests"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
@ -78,6 +78,16 @@
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "FeedParserTests"
|
||||
BuildableName = "FeedParserTests"
|
||||
BlueprintName = "FeedParserTests"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
|
@ -1,79 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1530"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES"
|
||||
buildArchitectures = "Automatic">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "Parser"
|
||||
BuildableName = "Parser"
|
||||
BlueprintName = "Parser"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
shouldAutocreateTestPlan = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "ParserTests"
|
||||
BuildableName = "ParserTests"
|
||||
BlueprintName = "ParserTests"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "Parser"
|
||||
BuildableName = "Parser"
|
||||
BlueprintName = "Parser"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
@ -9,9 +9,9 @@ let package = Package(
|
||||
products: [
|
||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||
.library(
|
||||
name: "Parser",
|
||||
name: "FeedParser",
|
||||
type: .dynamic,
|
||||
targets: ["Parser"]),
|
||||
targets: ["FeedParser"]),
|
||||
.library(
|
||||
name: "SAX",
|
||||
type: .dynamic,
|
||||
@ -36,7 +36,7 @@ let package = Package(
|
||||
.enableExperimentalFeature("StrictConcurrency")
|
||||
]),
|
||||
.target(
|
||||
name: "Parser",
|
||||
name: "FeedParser",
|
||||
dependencies: [
|
||||
"SAX"
|
||||
],
|
||||
@ -50,8 +50,8 @@ let package = Package(
|
||||
.enableExperimentalFeature("StrictConcurrency")
|
||||
]),
|
||||
.testTarget(
|
||||
name: "ParserTests",
|
||||
dependencies: ["Parser"],
|
||||
name: "FeedParserTests",
|
||||
dependencies: ["FeedParser"],
|
||||
exclude: ["Info.plist"],
|
||||
resources: [.copy("Resources")]),
|
||||
.testTarget(
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ParsedFeed: Sendable {
|
||||
public class ParsedFeed: Sendable {
|
||||
|
||||
public let type: FeedType
|
||||
public let title: String?
|
22
Modules/Parser/Sources/FeedParser/Feeds/XML/RSSParser.swift
Normal file
22
Modules/Parser/Sources/FeedParser/Feeds/XML/RSSParser.swift
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// RSSParser.swift
|
||||
// RSParser
|
||||
//
|
||||
// Created by Brent Simmons on 6/25/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SAX
|
||||
|
||||
public final class RSSParser {
|
||||
|
||||
private var parseFeed: ParsedFeed?
|
||||
|
||||
public static func parsedFeed(with parserData: ParserData) -> ParsedFeed? {
|
||||
|
||||
let parser = RSSParser(parserData)
|
||||
parser.parse()
|
||||
return parser.parsedFeed
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
//
|
||||
// RSSParser.swift
|
||||
// RSParser
|
||||
//
|
||||
// Created by Brent Simmons on 6/25/17.
|
||||
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// RSSParser wraps the Objective-C RSRSSParser.
|
||||
//
|
||||
// The Objective-C parser creates RSParsedFeed, RSParsedArticle, etc.
|
||||
// This wrapper then creates ParsedFeed, ParsedItem, etc. so that it creates
|
||||
// the same things that JSONFeedParser and RSSInJSONParser create.
|
||||
//
|
||||
// In general, you should see FeedParser.swift for all your feed-parsing needs.
|
||||
|
||||
public struct RSSParser {
|
||||
|
||||
public static func parse(_ parserData: ParserData) -> ParsedFeed? {
|
||||
|
||||
if let rsParsedFeed = RSRSSParser.parseFeed(with: parserData) {
|
||||
return RSParsedFeedTransformer.parsedFeed(rsParsedFeed)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user