Make all tasks run in parallel to increase responsiveness and efficiency when fetching new data. However, parallel tasks means that toast errors are no longer feasible. Instead, add a logging system which has a more detailed view of app messages and direct the user there if there is an error. Signed-off-by: kingbri <bdashore3@proton.me>
28 lines
612 B
Swift
28 lines
612 B
Swift
//
|
|
// SearchModels.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 9/2/22.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
// A raw search result structure displayed on the UI
|
|
public struct SearchResult: Codable, Hashable, Sendable {
|
|
let title: String?
|
|
let source: String
|
|
let size: String?
|
|
let magnet: Magnet
|
|
let seeders: String?
|
|
let leechers: String?
|
|
}
|
|
|
|
extension ScrapingViewModel {
|
|
// Contains both search results and magnet links for scalability
|
|
struct SearchRequestResult: Sendable {
|
|
let results: [SearchResult]
|
|
let magnets: [Magnet]
|
|
}
|
|
|
|
struct ScrapingError: Error {}
|
|
}
|