0

I am using a JTAppleCalendar pod file in my project and when I installed the pod file I couldn't use the method JTAppleCell and I just could use JTAppleDayCell I watched this video https://www.youtube.com/watch?v=Qd_Gc67xzlw and this https://www.youtube.com/watch?v=zOphH-h-qCs Here is my codes

import UIKit
import JTAppleCalendar

class calendarViewController: UIViewController {


@IBOutlet weak var calendarCollectionView: UICollectionView!


let formatter = DateFormatter()

override func viewDidLoad() {
    super.viewDidLoad()


}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()

}


}

extension calendarViewController : JTAppleCalendarViewDataSource {


func configureCalendar(_ calendar: JTAppleCalendarView) -> ConfigurationParameters {
    formatter.dateFormat = "yyyy MM dd"
    formatter.timeZone = Calendar.current.timeZone
    formatter.locale = Calendar.current.locale


    let startDate = formatter.date(from: "2017 01 01")!
    let endDate = formatter.date(from: "2017 12 31")!

    let parameters = ConfigurationParameters(startDate: startDate, endDate: endDate)
    return parameters
}


func calendar(_calebdar : JTAppleCalendarView , cellForItemAt date : Date , cellState : CellState , indexPath : IndexPath ) -> JTAppleDayCell {

    let cell = calendarCollectionView.dequeueReusableCell(withReuseIdentifier: "JTCustomCell", for: indexPath) as! JTCustomCell
    cell.dateLabel.text = cellState.text

    return cell
}

}
Mozahler
  • 4,958
  • 6
  • 36
  • 56
Saeed Rahmatolahi
  • 1,317
  • 2
  • 27
  • 60

1 Answers1

0

If you are only able to use JTAppleDayCell instead of JTAppleCell, then you are on the wrong version of the library. That video showed you for version 7.0

So the question I ask now is what version are you using? put this in your podfile:

pod 'JTAppleCalendar'

Then go to your console and run pod update.

The version should say 7.0.4 (which is the latest version as of this date). If it is saying some other version, then you're doing something wrong.

Just a coder
  • 15,480
  • 16
  • 85
  • 138
  • I tried to update that But I got this Error : tar: Unrecognized archive format tar: Error exit delayed from previous errors. – Saeed Rahmatolahi Jun 07 '17 at 04:10
  • in that case can you do a `pod --version` ? mine says 1.2.1 ; If you cocoapods itself is out of date then try updating cocoapods itself. If all else fails, then try putting this in your podfile and run a `pod install`. Put this in pod file -> `pod 'JTAppleCalendar', :git => 'https://github.com/patchthecode/JTAppleCalendar.git', :branch => 'master'` – Just a coder Jun 07 '17 at 10:01