Move function + WordFilter

This commit is contained in:
Lumaa 2024-06-25 14:33:37 +02:00
parent 5cae8cb458
commit d8096f5986
4 changed files with 25 additions and 8 deletions

View File

@ -25,14 +25,6 @@ class LoggedAccount {
} }
} }
public extension View {
@ViewBuilder
func modelData() -> some View {
self
.modelContainer(for: LoggedAccount.self)
}
}
public struct AppAccount: Codable, Identifiable, Hashable { public struct AppAccount: Codable, Identifiable, Hashable {
public let server: String public let server: String
public var accountName: String? public var accountName: String?

View File

@ -2,6 +2,7 @@
import Foundation import Foundation
import SwiftUI import SwiftUI
import SwiftData
/// A content filter designed for posts and its author /// A content filter designed for posts and its author
protocol PostFilter { protocol PostFilter {
@ -59,6 +60,9 @@ extension PostFilter {
} }
class ContentFilter { class ContentFilter {
static let defaultFilter: ContentFilter.WordFilter = .init(categoryName: "Default", words: [])
@Model
class WordFilter: PostFilter { class WordFilter: PostFilter {
let categoryName: String let categoryName: String
var content: [String] var content: [String]

View File

@ -39,6 +39,14 @@ struct ThreadedApp: App {
} }
} }
public extension View {
@ViewBuilder
func modelData() -> some View {
self
.modelContainer(for: [LoggedAccount.self, ContentFilter.WordFilter.self])
}
}
extension AppInfo { extension AppInfo {
static var appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown" static var appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"
} }

View File

@ -0,0 +1,13 @@
//Made by Lumaa
import SwiftUI
struct FilterView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
#Preview {
FilterView()
}