Implemented the Repository model in the app target.
This commit is contained in:
parent
37da844938
commit
62b5696378
38
Piper/Sources/Logic/Models/Repository.swift
Normal file
38
Piper/Sources/Logic/Models/Repository.swift
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
//
|
||||||
|
// Repository.swift
|
||||||
|
// Piper ~ App
|
||||||
|
//
|
||||||
|
// Created by Javier Cicchelli on 05/10/2024.
|
||||||
|
// Copyright © 2024 Röck+Cöde. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import SwiftData
|
||||||
|
|
||||||
|
@Model
|
||||||
|
final class Repository {
|
||||||
|
|
||||||
|
// MARK: Properties
|
||||||
|
|
||||||
|
@Attribute(.unique) var path: URL
|
||||||
|
|
||||||
|
var addedAt: Date
|
||||||
|
var sortOrder: Int
|
||||||
|
|
||||||
|
// MARK: Initialisers
|
||||||
|
|
||||||
|
init(
|
||||||
|
_ path: URL,
|
||||||
|
sortOrder: Int,
|
||||||
|
addedAt: Date = .now
|
||||||
|
) {
|
||||||
|
self.path = path
|
||||||
|
self.addedAt = addedAt
|
||||||
|
self.sortOrder = sortOrder
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Computed
|
||||||
|
|
||||||
|
@Transient var name: String { path.lastPathComponent }
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user