Skip to content

Commit b7871de

Browse files
authored
Merge pull request #10 from darrarski/fix/metadata-model
Fix Metadata model
2 parents 1bc9de7 + 1094790 commit b7871de

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

Example/DropboxClientExampleApp/ExampleView.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,18 @@ struct ExampleView: View {
161161
Text(entry.pathLower)
162162
}
163163

164-
VStack(alignment: .leading) {
165-
Text("Client modified").font(.caption).foregroundColor(.secondary)
166-
Text(entry.clientModified.formatted(date: .complete, time: .complete))
164+
if let date = entry.clientModified {
165+
VStack(alignment: .leading) {
166+
Text("Client modified").font(.caption).foregroundColor(.secondary)
167+
Text(date.formatted(date: .complete, time: .complete))
168+
}
167169
}
168170

169-
VStack(alignment: .leading) {
170-
Text("Server modified").font(.caption).foregroundColor(.secondary)
171-
Text(entry.serverModified.formatted(date: .complete, time: .complete))
171+
if let date = entry.serverModified {
172+
VStack(alignment: .leading) {
173+
Text("Server modified").font(.caption).foregroundColor(.secondary)
174+
Text(date.formatted(date: .complete, time: .complete))
175+
}
172176
}
173177
}
174178

Sources/DropboxClient/Metadata.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ public struct Metadata: Sendable, Equatable, Identifiable {
1111
name: String,
1212
pathDisplay: String,
1313
pathLower: String,
14-
clientModified: Date,
15-
serverModified: Date,
16-
isDownloadable: Bool
14+
clientModified: Date?,
15+
serverModified: Date?,
16+
isDownloadable: Bool?
1717
) {
1818
self.tag = tag
1919
self.id = id
@@ -30,9 +30,9 @@ public struct Metadata: Sendable, Equatable, Identifiable {
3030
public var name: String
3131
public var pathDisplay: String
3232
public var pathLower: String
33-
public var clientModified: Date
34-
public var serverModified: Date
35-
public var isDownloadable: Bool
33+
public var clientModified: Date?
34+
public var serverModified: Date?
35+
public var isDownloadable: Bool?
3636
}
3737

3838
extension Metadata: Codable {

0 commit comments

Comments
 (0)