mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-06-16 04:00:39 +00:00
34 lines
750 B
Swift
34 lines
750 B
Swift
//
|
|
// FetchedResults<RSSFeed>+toRSSItems.swift
|
|
//
|
|
//
|
|
// Created by Duong Thai on 14/3/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
extension FetchedResults<RSSFeed> {
|
|
func toRSSItems() -> [RSSItem] { self.flatMap { $0.toRSSItems() } }
|
|
}
|
|
|
|
extension RSSFeed {
|
|
func toRSSItems() -> [RSSItem] { ((self.items?.allObjects as? [RSSItem]) ?? []) }
|
|
}
|
|
|
|
extension Optional<Date>: Comparable {
|
|
public static func < (lhs: Optional, rhs: Optional) -> Bool {
|
|
if let lhs, let rhs { lhs < rhs }
|
|
else { false }
|
|
}
|
|
|
|
public static func > (lhs: Optional, rhs: Optional) -> Bool {
|
|
if let lhs, let rhs { lhs > rhs }
|
|
else { false }
|
|
}
|
|
|
|
public static func == (lhs: Optional, rhs: Optional) -> Bool {
|
|
if let lhs, let rhs { lhs == rhs }
|
|
else { false }
|
|
}
|
|
}
|