From 0127fd4d0bff118bb84ad7cdfb804cec24c5d2af Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 18 Aug 2024 21:08:01 -0700 Subject: [PATCH] Import RSOPMLDocument to Swift. --- .../Sources/Parser/OPML/OPMLDocument.swift | 15 +++++++++++++ .../Parser/Sources/Parser/OPML/OPMLItem.swift | 10 ++++----- .../Sources/ParserObjC/RSOPMLDocument.h | 21 ------------------- .../Sources/ParserObjC/RSOPMLDocument.m | 14 ------------- 4 files changed, 20 insertions(+), 40 deletions(-) create mode 100644 Modules/Parser/Sources/Parser/OPML/OPMLDocument.swift delete mode 100755 Modules/ParserObjC/Sources/ParserObjC/RSOPMLDocument.h delete mode 100755 Modules/ParserObjC/Sources/ParserObjC/RSOPMLDocument.m diff --git a/Modules/Parser/Sources/Parser/OPML/OPMLDocument.swift b/Modules/Parser/Sources/Parser/OPML/OPMLDocument.swift new file mode 100644 index 000000000..b977b2768 --- /dev/null +++ b/Modules/Parser/Sources/Parser/OPML/OPMLDocument.swift @@ -0,0 +1,15 @@ +// +// OPMLDocument.swift +// +// +// Created by Brent Simmons on 8/18/24. +// + +import Foundation + +public struct OPMLDocument: Sendable { + + public let title: String + public let url: String + public let items: [OPMLItem]? +} diff --git a/Modules/Parser/Sources/Parser/OPML/OPMLItem.swift b/Modules/Parser/Sources/Parser/OPML/OPMLItem.swift index 76a170060..caff99a38 100644 --- a/Modules/Parser/Sources/Parser/OPML/OPMLItem.swift +++ b/Modules/Parser/Sources/Parser/OPML/OPMLItem.swift @@ -8,7 +8,7 @@ import Foundation import os -public final class OPMLItem: Sendable { +public struct OPMLItem: Sendable { public let feedSpecifier: OPMLFeedSpecifier @@ -16,9 +16,9 @@ public final class OPMLItem: Sendable { public let titleFromAttributes: String? public let isFolder: Bool - public let children: [OPMLItem]? + public let items: [OPMLItem]? - init?(attributes: [String : String], children: [OPMLItem]?) { + init?(attributes: [String : String], items: [OPMLItem]?) { guard let feedURL = attributes.opml_xmlUrl, !feedURL.isEmpty else { return nil @@ -36,7 +36,7 @@ public final class OPMLItem: Sendable { self.attributes = attributes - self.children = children - self.isFolder = (children?.count ?? 0) > 0 + self.items = items + self.isFolder = (items?.count ?? 0) > 0 } } diff --git a/Modules/ParserObjC/Sources/ParserObjC/RSOPMLDocument.h b/Modules/ParserObjC/Sources/ParserObjC/RSOPMLDocument.h deleted file mode 100755 index 5061853fe..000000000 --- a/Modules/ParserObjC/Sources/ParserObjC/RSOPMLDocument.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// RSOPMLDocument.h -// RSParser -// -// Created by Brent Simmons on 2/28/16. -// Copyright © 2016 Ranchero Software, LLC. All rights reserved. -// - -@import Foundation; - -#import "RSOPMLItem.h" - - - - -@interface RSOPMLDocument : RSOPMLItem - -@property (nonatomic) NSString *title; -@property (nonatomic) NSString *url; - -@end diff --git a/Modules/ParserObjC/Sources/ParserObjC/RSOPMLDocument.m b/Modules/ParserObjC/Sources/ParserObjC/RSOPMLDocument.m deleted file mode 100755 index 1506bd911..000000000 --- a/Modules/ParserObjC/Sources/ParserObjC/RSOPMLDocument.m +++ /dev/null @@ -1,14 +0,0 @@ -// -// RSOPMLDocument.m -// RSParser -// -// Created by Brent Simmons on 2/28/16. -// Copyright © 2016 Ranchero Software, LLC. All rights reserved. -// - - -#import "RSOPMLDocument.h" - -@implementation RSOPMLDocument - -@end