Import RSOPMLDocument to Swift.

This commit is contained in:
Brent Simmons
2024-08-18 21:08:01 -07:00
parent ad00ee52ff
commit 0127fd4d0b
4 changed files with 20 additions and 40 deletions

View File

@@ -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]?
}

View File

@@ -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
}
}

View File

@@ -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

View File

@@ -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