CalendarFoundation
基于 Swift 的 iOS 应用程序简单日期选择器。让用户从日历中选择某些天(或不选择)。
安装
CocoaPods
pod 'CalendarFoundation'
使用方法
import CalendarFoundation
// Initialize new instance of controller with `dateSelectedBlock`
let calendarVC = CalendarViewController(dateSelectedBlock: { [weak self] date in
if let date = date {
// work with received `Date`
} else {
// user selected option "Remove date" = `date` is `nil`
}
})
// From you `UIViewController` present it
present(calendarVC, animated: true)
用户体验
- 滑动以更改月份
- 点击天数以选择
日期
- 点击 Remove 日期以返回
nil
- 点击任意地方以关闭日历