Skip to content

Commit 16d8f43

Browse files
authored
fix: Add a TimelineView to the example app (#35)
1 parent 7cd84e8 commit 16d8f43

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎Example/Example/Views/Cell.swift‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ struct Cell: View {
3434
}
3535
}
3636

37+
static let dateFormatter: DateFormatter = {
38+
let dateFormatter = DateFormatter()
39+
dateFormatter.dateStyle = .medium
40+
dateFormatter.timeStyle = .long
41+
return dateFormatter
42+
}()
43+
3744
@Environment(\.isSelected) var isSelected
3845
@Environment(\.highlightState) var highlightState
3946
@Environment(\.selectionColor) var selectionColor
@@ -57,6 +64,9 @@ struct Cell: View {
5764
}
5865
Text(item.count, format: .number)
5966
.font(.title)
67+
TimelineView(.periodic(from: .now, by: 1.0)) { context in
68+
Text(Self.dateFormatter.string(from: context.date))
69+
}
6070
Spacer()
6171
}
6272
.background(isPainted ? .mint : item.color.opacity(0.4))

0 commit comments

Comments
 (0)