Defined the Folder model and integrated it to the BrowseView view for the Browse module.
This commit is contained in:
parent
c1c25c356d
commit
6478a57bba
@ -33,7 +33,10 @@ struct ContentView: View {
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
BrowseView {
|
||||
BrowseView(folder: .init(
|
||||
id: user?.rootFolder.id,
|
||||
name: user?.rootFolder.name
|
||||
)) {
|
||||
// ...
|
||||
} uploadFile: {
|
||||
// ...
|
||||
|
26
Modules/Sources/Browse/UI/Models/Folder.swift
Normal file
26
Modules/Sources/Browse/UI/Models/Folder.swift
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// Folder.swift
|
||||
// Browse
|
||||
//
|
||||
// Created by Javier Cicchelli on 13/12/2022.
|
||||
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||
//
|
||||
|
||||
public struct Folder {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public let id: String
|
||||
public let name: String
|
||||
|
||||
// MARK: Initialisers
|
||||
|
||||
public init(
|
||||
id: String? = nil,
|
||||
name: String? = nil
|
||||
) {
|
||||
self.id = id ?? "-"
|
||||
self.name = name ?? "-"
|
||||
}
|
||||
|
||||
}
|
@ -13,6 +13,7 @@ public struct BrowseView: View {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
private let folder: Folder
|
||||
private let createFolder: ActionClosure
|
||||
private let uploadFile: ActionClosure
|
||||
private let showProfile: ActionClosure
|
||||
@ -20,10 +21,12 @@ public struct BrowseView: View {
|
||||
// MARK: Initialisers
|
||||
|
||||
public init(
|
||||
folder: Folder,
|
||||
createFolder: @escaping ActionClosure,
|
||||
uploadFile: @escaping ActionClosure,
|
||||
showProfile: @escaping ActionClosure
|
||||
) {
|
||||
self.folder = folder
|
||||
self.createFolder = createFolder
|
||||
self.uploadFile = uploadFile
|
||||
self.showProfile = showProfile
|
||||
@ -119,7 +122,7 @@ public struct BrowseView: View {
|
||||
}
|
||||
.listStyle(.inset)
|
||||
.background(Color.red)
|
||||
.navigationTitle("Folder name")
|
||||
.navigationTitle(folder.name)
|
||||
.toolbar {
|
||||
BrowseToolbar(
|
||||
createFolder: createFolder,
|
||||
@ -142,7 +145,10 @@ private extension Image {
|
||||
struct BrowseView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
NavigationView {
|
||||
BrowseView {
|
||||
BrowseView(folder: .init(
|
||||
id: UUID().uuidString,
|
||||
name: "Some folder name"
|
||||
)) {
|
||||
// ...
|
||||
} uploadFile: {
|
||||
// ...
|
||||
|
Loading…
x
Reference in New Issue
Block a user