Defined the Model protocol and implemented the File and Folder models for the Browse module.
This commit is contained in:
parent
6478a57bba
commit
d0371c6e48
30
Modules/Sources/Browse/Logic/Models/File.swift
Normal file
30
Modules/Sources/Browse/Logic/Models/File.swift
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// File.swift
|
||||
// Browse
|
||||
//
|
||||
// Created by Javier Cicchelli on 13/12/2022.
|
||||
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||
//
|
||||
|
||||
struct File {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public let id: String
|
||||
public let name: String
|
||||
|
||||
// MARK: Initialisers
|
||||
|
||||
public init(
|
||||
id: String,
|
||||
name: String
|
||||
) {
|
||||
self.id = id
|
||||
self.name = name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - ModelIdentifiable
|
||||
|
||||
extension File: ModelIdentifiable {}
|
@ -16,11 +16,15 @@ public struct Folder {
|
||||
// MARK: Initialisers
|
||||
|
||||
public init(
|
||||
id: String? = nil,
|
||||
name: String? = nil
|
||||
id: String,
|
||||
name: String
|
||||
) {
|
||||
self.id = id ?? "-"
|
||||
self.name = name ?? "-"
|
||||
self.id = id
|
||||
self.name = name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - ModelIdentifiable
|
||||
|
||||
extension Folder: ModelIdentifiable {}
|
16
Modules/Sources/Browse/Logic/Protocols/Model.swift
Normal file
16
Modules/Sources/Browse/Logic/Protocols/Model.swift
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// Model.swift
|
||||
// Browse
|
||||
//
|
||||
// Created by Javier Cicchelli on 13/12/2022.
|
||||
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||
//
|
||||
|
||||
protocol Model {
|
||||
var id: String { get }
|
||||
var name: String { get }
|
||||
}
|
||||
|
||||
// MARK: - Type aliases
|
||||
|
||||
typealias ModelIdentifiable = Model & Identifiable
|
Loading…
x
Reference in New Issue
Block a user