DGDatePicker 1.0.2

DGDatePicker 1.0.2

Dimitris Georgiou 维护。



  • Dimitris Georgiou

预览

picture

安装

要使用 CocoaPods 将 DGDatePicker 集成到你的 Xcode 项目中,请指定它在你的 Podfile

# 1. Add the remote repos
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/dgrgiou/DGPrivatePodSpecs.git'

platform :ios, '11.0'
use_frameworks!

target '<Your Target Name>' do
    # 2. Add pod 
    pod 'DGDatePicker'
end

然后,运行以下命令

$ pod install

使用方法

// 1. Import module
import DGDatePicker

// 2. Add CalendarProtocol
class ViewController: UIViewController, CalendarProtocol {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    .
    .
    .
    
    // 3. Conform to required method
    func calendarDidClosed(selectedDate: Date) {
        // The callback from the selected date
    }
    
    // 4. Show modal calendar simple like this
    func showCalendar() {
        let calendarVC = CalendarVC()
        calendarVC.modalPresentationStyle = .overCurrentContext
        calendarVC.calendarDelegate = self
        present(calendarVC, animated: true, completion: nil)
    }
}