Remove all iOS 14 specific components and workarounds and comply with SwiftUI 3. Signed-off-by: kingbri <bdashore3@proton.me>
62 lines
2.1 KiB
Swift
62 lines
2.1 KiB
Swift
//
|
|
// SourceSettingsMethodView.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 3/24/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SourceSettingsMethodView: View {
|
|
@ObservedObject var selectedSource: Source
|
|
|
|
var body: some View {
|
|
Section(header: InlineHeader("Fetch method")) {
|
|
if selectedSource.jsonParser != nil {
|
|
Button {
|
|
selectedSource.preferredParser = SourcePreferredParser.siteApi.rawValue
|
|
} label: {
|
|
HStack {
|
|
Text("Website API")
|
|
Spacer()
|
|
if SourcePreferredParser.siteApi.rawValue == selectedSource.preferredParser {
|
|
Image(systemName: "checkmark")
|
|
.foregroundColor(.blue)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if selectedSource.rssParser != nil {
|
|
Button {
|
|
selectedSource.preferredParser = SourcePreferredParser.rss.rawValue
|
|
} label: {
|
|
HStack {
|
|
Text("RSS")
|
|
Spacer()
|
|
if SourcePreferredParser.rss.rawValue == selectedSource.preferredParser {
|
|
Image(systemName: "checkmark")
|
|
.foregroundColor(.blue)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if selectedSource.htmlParser != nil {
|
|
Button {
|
|
selectedSource.preferredParser = SourcePreferredParser.scraping.rawValue
|
|
} label: {
|
|
HStack {
|
|
Text("Web scraping")
|
|
Spacer()
|
|
if SourcePreferredParser.scraping.rawValue == selectedSource.preferredParser {
|
|
Image(systemName: "checkmark")
|
|
.foregroundColor(.blue)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.tint(.primary)
|
|
}
|
|
}
|