title: UITableView cellForRowAt indexPath events for next 30 days
body: <p>I have this code below with Islamic dates (month and day only). What I'm trying to do is create a row in my tableview for events in the next 30 days. I tried the below but it's not working. I know I'm obviously a beginner and doing something very wrong here but I'm just not sure how to do it correctly then. </p>
  
  <pre><code>  var calendarDataSource = [
          "08/02": "SomeData",
          "08/03": "SomeData",
          "08/04": "SomeData",
          "08/05": "SomeData",
          "08/06": "SomeData",
          "08/07": "SomeData",
          "08/08": "SomeData",
          "08/09": "SomeData",
          "08/10": "SomeData",
          "08/11": "SomeData",
          "08/12": "SomeData",
          "08/13": "SomeData",
          "08/14": "SomeData",
          "08/15": "SomeData"
      ]
  
  
  
  
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "calendarTVC") as! CalendarTableViewCell
  
  
      formatter.dateFormat = "yyyy MM dd"
      let islamicFormatter = DateFormatter()
      islamicFormatter.dateFormat = "MM/dd"
      islamicFormatter.calendar = Calendar(identifier: .islamic)
  
      let gregorianFormatter = DateFormatter()
      gregorianFormatter.calendar = Calendar(identifier: .gregorian)
      gregorianFormatter.dateStyle = .short
      gregorianFormatter.dateFormat = "yyyy MM dd"
  
  
      for index in 0...29 {
          let nextdate = Calendar.current.date(byAdding: .day, value: index, to: Date())
          let dayInt = Calendar.current.component(.day, from: nextdate!)
          let monthInt = Calendar.current.component(.month, from: nextdate!)
          let yearInt = Calendar.current.component(.year, from: nextdate!)
          print(date)
          let dateString = "\(yearInt) \(monthInt) \(dayInt)"
  
          if let date = gregorianFormatter.date(from: dateString) {
              let islamicString = islamicFormatter.string(from: date)
  
              if calendarDataSource[islamicString] == dateString {
                  cell.TVDayLabel.text = Array(calendarDataSource.keys)[indexPath.row]
                  cell.TVEventLabel.text = Array(calendarDataSource.values)[indexPath.row]
  
              } else {
                  print("no event")
              }
          }
      }
  
          return cell
      }
  </code></pre>
  
  <p>Edit: Adding what results of this
  <a href="https://i.stack.imgur.com/ciPTO.png" rel="nofollow noreferrer">Link to image</a></p>