Skip to content

Commit

Permalink
Fixed #96 & #97: Added option to customize calendar and fix issue loa…
Browse files Browse the repository at this point in the history
…ding nib when integrating manually
  • Loading branch information
huongvinid committed Mar 15, 2020
1 parent ca15855 commit cf842f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DateTimePicker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
9 changes: 5 additions & 4 deletions Source/DateTimePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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 {
Expand All @@ -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")
}
Expand Down

0 comments on commit cf842f2

Please sign in to comment.