Display Timestamp from Firestore to Charts iOS

I am trying to take a timestamp saved in Firestore and display it in my app using ios Charts. Here is my code:

import UIKit
import Charts
import Firebase
import FirebaseFirestoreSwift
import FirebaseAuth

class YearChartViewController: UIViewController, ChartViewDelegate {

private var timeRetrieval = [timeData]()

var barChart = BarChartView()

lazy var companyUser = ""

@IBOutlet weak var localeIdLabel: UILabel!

private var timeDataCollection: CollectionReference!

override func viewDidLoad() {
    barChart.delegate = self
    localeIdLabel.text = companyUser
    timeDataCollection = Firestore.firestore().collection("users").document(companyUser ).collection("time_data")


override func viewDidLayoutSubviews() {
    barChart.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height)
    barChart.center = view.center
    var entries = [BarChartDataEntry]()
    for i in 0..<timeRetrieval.count {
        let formatter = DateFormatter();
        formatter.dateFormat = "yyyy"
    timeDataCollection.getDocuments { (querySnapshot, error) in
                    if let err = error {
                        debugPrint("Error fetching docs: \(err)")
                    } else {
                     guard let snap = querySnapshot else { return }
                     for document in snap.documents {
                         let FirebaseData = document.data()
                        let tiempoEs = formatter.string(from: FirebaseData["timestamp"] as? Date ?? Date())
                        let documentIdThird = document.documentID
                        let newTimeRetrieval = timeData(timeContinuum: tiempoEs, documentId3: documentIdThird)

                        entries.append(BarChartDataEntry(x: Double(timeRetrieval[i]), y: Double(timeRetrieval[i])))
    let set = BarChartDataSet(entries: entries
    set.colors = ChartColorTemplates.joyful()
    let data = BarChartData(dataSet: set)
                self.barChart.data = data


“timeRetrieval” is taken from a class called “timeData”:

 import Foundation
 import Firebase

 class timeData {
   var timeContinuum: String!
   var documentId3: String!

init(timeContinuum: String, documentId3: String) {
    self.timeContinuum = timeContinuum
    self.documentId3 = documentId3

When I try to the value “timeRetreival[i]” in the first block of code into a Double, it says that “Initializer ‘init(_:)’ requires that ‘timeData’ conform to ‘BinaryInteger’”. If I don’t wrap it into a Double value, it reads “Cannot convert value of type ‘timeData’ to expected argument type ‘Double’”. What would anyone suggest to solve this?