To run the example project, clone the repo, and run pod install
from the Example directory first.
WHLunarCalendar is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'WHLunarCalendar', :git => 'https://github.com/KimWooHyun/WHLunarCalendar.git', :branch => 'master'
- Add UIView
- Add custom class
- Import WHLunarCalendar & add delegate
ViewController.swift
import UIKit
import WHLunarCalendar
class ViewController: UIViewController {
@IBOutlet weak var lunarCalendar: WHLunarCalendar!
override func viewDidLoad() {
super.viewDidLoad()
self.lunarCalendar.delegate = self
}
}
- Add event
Extension
extension ViewController: LunarCalendarDelegate{
func lunarCalendarCellClick(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let cell = collectionView.cellForItem(at: indexPath) as! WHLunarCalendarCell
print(cell.solorDay)
print(cell.lunarDay) // Optional
print(cell.isLeap) // Optional
}
}
kimwoohyun, [email protected]
WHLunarCalendar is available under the MIT license. See the LICENSE file for more info.