Move function + WordFilter
This commit is contained in:
parent
5cae8cb458
commit
d8096f5986
|
@ -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 let server: String
|
||||
public var accountName: String?
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import SwiftData
|
||||
|
||||
/// A content filter designed for posts and its author
|
||||
protocol PostFilter {
|
||||
|
@ -59,6 +60,9 @@ extension PostFilter {
|
|||
}
|
||||
|
||||
class ContentFilter {
|
||||
static let defaultFilter: ContentFilter.WordFilter = .init(categoryName: "Default", words: [])
|
||||
|
||||
@Model
|
||||
class WordFilter: PostFilter {
|
||||
let categoryName: String
|
||||
var content: [String]
|
||||
|
|
|
@ -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 {
|
||||
static var appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
Loading…
Reference in New Issue