, " ", UICollectionView ( JTAppleCalendar) willDisplay , , , , , , , JTAppleCalendar gitHub issues nub .
, :
ViewController.swift
extension ViewController: JTAppleCalendarViewDelegate, JTAppleCalendarViewDataSource {
func calendar(_ calendar: JTAppleCalendarView, willDisplay cell: JTAppleCell, forItemAt date: Date, cellState: CellState, indexPath: IndexPath) {
var cell = cell as! CellView
cell = sharedFunctionToConfigureCell(cell: cell, cellState: cellState, date: date)
}
func calendar(_ calendar: JTAppleCalendarView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -> JTAppleCell {
var cell = calendar.dequeueReusableCell(withReuseIdentifier: "CellView", for: indexPath) as! CellView
cell = sharedFunctionToConfigureCell(cell: cell, cellState: cellState, date: date)
return cell
}
func sharedFunctionToConfigureCell(cell: CellView, cellState: CellState, date: Date)-> CellView {
var currentdate = String(describing: myCalendar.date(byAdding: .day, value: 1, to: cellState.date))
currentdate = currentdate.substring(from: 9, length: 10)
cell.tagList.tags.removeAll()
cell.tagList.hide()
cell.contentView.backgroundColor = nil
cell.tagList.alpha = 0
cell.tagList.numberOfRows = 0
cell.tagList.backgroundColor = UIColor.clear
cell.tagList.isHidden = true
var i : Int
i = 0
for object in datas {
i = i + 1
let clean = "\(object)".components(separatedBy: "*")
if clean[0] == currentdate {
let gotag : Int
gotag = Int(clean[1])!
cell.tagList.isHidden = false
cell.dayLabel.text = cellState.text
cell.contentView.backgroundColor = UIColor.gray
let itemName = "Item name \(i)"
cell.tagList.alpha = 1
if clean[1] == "1" {
cell.tagList.addTag(itemName, target: self, tapAction: #selector(ViewController.tap(_:)), longPressAction: #selector(ViewController.tap(_:)),backgroundColor: UIColor.orange,textColor: UIColor.white,comesTag: gotag)
}else if clean[1] == "2" {
cell.tagList.addTag(itemName, target: self, tapAction: #selector(ViewController.tap(_:)), longPressAction: #selector(ViewController.tap(_:)),backgroundColor: UIColor.green,textColor: UIColor.white,comesTag: gotag)
}else if clean[1] == "3" {
cell.tagList.addTag(itemName, target: self, tapAction: #selector(ViewController.tap(_:)), longPressAction: #selector(ViewController.tap(_:)),backgroundColor: UIColor.brown,textColor: UIColor.white,comesTag: gotag)
}else if clean[1] == "4" {
cell.tagList.addTag(itemName, target: self, tapAction: #selector(ViewController.tap(_:)), longPressAction: #selector(ViewController.tap(_:)),backgroundColor: UIColor.black,textColor: UIColor.white,comesTag: gotag)
}
}else{
cell.tagList.backgroundColor = UIColor.clear
}
}
handleCellConfiguration(cell: cell, cellState: cellState)
return cell
}
( ):
.
, mainStoryBoard , , DesignableButton (nonistent class) UIButton, , : CalendarBug[9879:1645088] Unknown class _TtC11CalendarBug16DesignableButton in Interface Builder file.

, JTAppleCaledar , , willDisplay, .
TagListView.swift, reset.
TagListView.swift:
func reset() {
for tag in tags {
tag.removeFromSuperview()
}
tags = []
currentRow = 0
numberOfRows = 0
}
( ) , , , , , tags. , , reset, ( , UILabel, tag):
func reset() {
for tag in tags {
tag.removeFromSuperview()
}
tags = []
currentRow = 0
numberOfRows = 0
self.subviews.forEach({ if $0 is UILabel { $0.removeFromSuperview()} })
}
, :
func reset(){
tags = []
currentRow = 0
numberOfRows = 0
self.subviews.forEach({ if $0 is UILabel { $0.removeFromSuperview()} })
}
