piper-app/Piper/Sources/Previews/Extensions/Repository+Samples.swift
Javier Cicchelli 3d78c599d1 [App] Repositories in the Menu Bar view (#4)
This PR contains the work done to implement the rendering of the (lack of) repositories in the `MenuBarView` view UI interface. For this purpose, some components have been created: `ListHeader`, `ListItemEmpty`, and `ListItem`. Furthermore, some preview-specific code have been implemented as well, specially to add dummy repositories to the previews.

Reviewed-on: #4
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2024-10-06 11:50:36 +00:00

37 lines
810 B
Swift

//
// Repository+Samples.swift
// Piper
//
// Created by Javier Cicchelli on 06/10/2024.
// Copyright © 2024 Röck+Cöde. All rights reserved.
//
import Foundation
import SwiftData
extension Repository {
// MARK: Functions
@MainActor
static func samples(in container: ModelContainer) {
let context = container.mainContext
context.insert(Repository(
URL(filePath: "/full/path/to/repository/name-0.git"),
sortOrder: 0
))
context.insert(Repository(
URL(filePath: "/full/path/to/repository/name-1.git"),
sortOrder: 1
))
context.insert(Repository(
URL(filePath: "/full/path/to/repository/name-2.git"),
sortOrder: 2
))
}
}