Reputation: 1338
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
}
}
Upvotes: 0
Views: 1073
Reputation: 16720
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.
Upvotes: 0