This commit is contained in:
2025-07-13 21:54:09 -04:00
parent 0545f5dbc7
commit bdaa406876
33 changed files with 984 additions and 714 deletions

View File

@ -0,0 +1,27 @@
import SwiftUI
import SwiftData
/// A protocol for entities that can be managed in a generic list view.
protocol EditableEntity: PersistentModel, Identifiable, Hashable {
/// The name of the entity to be displayed in the list.
var name: String { get set }
/// A view for adding or editing the entity.
associatedtype FormView: View
@ViewBuilder static func formView(for model: Self) -> FormView
/// Creates a new, empty instance of the entity.
static func createNew() -> Self
/// The title for the navigation bar in the list view.
static var navigationTitle: String { get }
/// An optional property to specify a count to be displayed in the list item.
var count: Int? { get }
}
extension EditableEntity {
var count: Int? {
return nil
}
}