From cf842f2afd2fb2dc96d17b01a309eff490d23b7e Mon Sep 17 00:00:00 2001 From: Huong Do Date: Sun, 15 Mar 2020 11:42:36 +0700 Subject: [PATCH] Fixed #96 & #97: Added option to customize calendar and fix issue loading nib when integrating manually --- DateTimePicker.podspec | 2 +- Source/DateTimePicker.swift | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/DateTimePicker.podspec b/DateTimePicker.podspec index d262597..3a7832c 100644 --- a/DateTimePicker.podspec +++ b/DateTimePicker.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| # s.name = "DateTimePicker" - s.version = "2.4.0" + s.version = "2.4.1" s.summary = "A nicer iOS UI component for picking date and time." s.description = "DateTimePicker makes it easy to select date and time with an attractive looking component." diff --git a/Source/DateTimePicker.swift b/Source/DateTimePicker.swift index 861f807..4294874 100644 --- a/Source/DateTimePicker.swift +++ b/Source/DateTimePicker.swift @@ -242,7 +242,9 @@ public protocol DateTimePickerDelegate: class { } } - public var timeZone = TimeZone.current + public var timeZone: TimeZone = .current + public var calendar: Calendar = .current + public var completionHandler: ((Date)->Void)? public var dismissHandler: (() -> Void)? public weak var delegate: DateTimePickerDelegate? @@ -279,7 +281,6 @@ public protocol DateTimePickerDelegate: class { internal var minimumDate: Date! internal var maximumDate: Date! - internal var calendar: Calendar = .current internal var dates: [Date]! = [] internal var components: DateComponents! { didSet { @@ -290,13 +291,13 @@ public protocol DateTimePickerDelegate: class { private static var resourceBundle: Bundle? { let podBundle = Bundle(for: DateTimePicker.self) guard let bundleURL = podBundle.url(forResource: "DateTimePicker", withExtension: "bundle") else { - return nil + return Bundle.main } return Bundle(url: bundleURL) } @objc open class func create(minimumDate: Date? = nil, maximumDate: Date? = nil) -> DateTimePicker { - + guard let dateTimePicker = resourceBundle?.loadNibNamed("DateTimePicker", owner: nil, options: nil)?.first as? DateTimePicker else { fatalError("Error loading nib") }