mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-18 12:28:37 +01:00
27 lines
550 B
Swift
27 lines
550 B
Swift
|
//
|
||
|
// DatabaseObject+Database.swift
|
||
|
// Database
|
||
|
//
|
||
|
// Created by Brent Simmons on 9/13/17.
|
||
|
// Copyright © 2017 Ranchero Software. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
import RSDatabase
|
||
|
import Data
|
||
|
|
||
|
extension Array where Element == DatabaseObject {
|
||
|
|
||
|
func asAuthors() -> Set<Author>? {
|
||
|
|
||
|
let authors = Set(self.map { $0 as! Author })
|
||
|
return authors.isEmpty ? nil : authors
|
||
|
}
|
||
|
|
||
|
func asAttachments() -> Set<Attachment>? {
|
||
|
|
||
|
let attachments = Set(self.map { $0 as! Attachment })
|
||
|
return attachments.isEmpty ? nil : attachments
|
||
|
}
|
||
|
}
|