title: Updating date(time) in cell after selecting DatePicker
body: <p>I'm currently an app that has a feature that allows users to add schedule(time)</p>
  
  <p>Here's the progress I made so far<br>
  1. Added textview and datepicker and made the datepicker enable after tapping the textView<br> 
  2. Time (the time I run the project) is displayed on each cell(as attached picture) <br></p>
  
  <p>I want to display date(like 10:10PM in the screen short) in the cell after selecting time in datepicker, but unable to update the selected time.<br> 
  Any ideas how to do this? <br> 
  Thanks in advance.</p>
  
  <p><img src="https://image.ibb.co/fcPgnp/0030_08_26_8.pngg" width="200" /></p>
  
  <p>TimeSelectorViewController:</p>
  
  <pre><code>import UIKit
  
  class TimeSelectorController: UICollectionViewController, 
  UICollectionViewDelegateFlowLayout, UITextViewDelegate {
  
  let cellId = "cellId"
  
  let timeSelectorCell = TimeSelectorCell()
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      collectionView.backgroundColor = .yellow
  
      collectionView.reloadData()
      navigationItem.leftBarButtonItem = UIBarButtonItem(title: "V", style: .plain, target: self, action: #selector(handleBack))
  
      collectionView.register(TimeSelectorCell.self, forCellWithReuseIdentifier: cellId)
  }
  
  
  @objc fileprivate func handleBack() {
      dismiss(animated: true, completion: nil)
  }
  
  
  override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
      return 5
  }
  
  
  override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {
  
      let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) as! TimeSelectorCell
  
      cell.textView.inputView = timeSelectorCell.timePicker
      cell.textView.text = timeSelectorCell.handleSelectedTime()
  
      return cell
  }
  
  
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -&gt; CGSize {
  
      return CGSize(width: view.frame.width, height: 50)
     }
  
  }
  </code></pre>
  
  <p>TableSelectorCell: </p>
  
  <pre><code>import UIKit
  
  class TimeSelectorCell: UICollectionViewCell {
  
  
  let textView: UITextView = {
      let tv = UITextView()
      tv.text = "Time Goes Here"
      tv.isEditable = false
      return tv
  }()
  
  lazy var timePicker: UIDatePicker = {
      let picker = UIDatePicker()
      picker.datePickerMode = .time
      picker.minuteInterval = 10
      //picker.minuteInterval = 30
      picker.addTarget(self, action: #selector(handleSelectedTime), for: .valueChanged)
      return picker
  }()
  
  @objc func handleSelectedTime() -&gt; String {
      let dateFormatter = DateFormatter()
      dateFormatter.dateFormat = "HH:mm"
      let selectTime = dateFormatter.string(from: timePicker.date)
  
      textView.inputView = timePicker
      textView.text = selectTime
  
      print(selectTime)
  
      return selectTime
  }
  
  
  override init(frame: CGRect) {
      super.init(frame: frame)
  
      addSubview(textView)
      textView.anchor(top: topAnchor, left: leftAnchor, bottom: bottomAnchor, right: rightAnchor, paddingTop: 0, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, height: 0, width: 0)
  }
  
  required init?(coder aDecoder: NSCoder) {
      fatalError("init(coder:) has not been implemented")
     }
   }
  </code></pre>