Skip to content

Commit 6669cb9

Browse files
authored
Merge pull request #4 from wojteklembryk/master
Custom cancel and done buttons
2 parents 005b4a9 + 217e852 commit 6669cb9

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Fastis.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Fastis'
3-
s.version = '1.0.10'
3+
s.version = '1.0.11'
44
s.summary = "Simple date picker created using JTAppleCalendar library"
55
s.description = <<-DESC
66
Fastis is a fully customizable UI component for picking dates and ranges created using JTAppleCalendar library.

Source/Views/Controller.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,24 @@ public class FastisController<Value: FastisValue>: UIViewController, JTACMonthVi
1515
// MARK: - Outlets
1616

1717
private lazy var cancelBarButtonItem: UIBarButtonItem = {
18+
if let customButton = self.appearance.customCancelButton {
19+
customButton.target = self
20+
customButton.action = #selector(self.cancel)
21+
return customButton
22+
}
23+
1824
let barButtonItem = UIBarButtonItem(title: self.appearance.cancelButtonTitle, style: .plain, target: self, action: #selector(self.cancel))
1925
barButtonItem.tintColor = self.appearance.barButtonItemsColor
2026
return barButtonItem
2127
}()
2228

2329
private lazy var doneBarButtonItem: UIBarButtonItem = {
30+
if let customButton = self.appearance.customDoneButton {
31+
customButton.target = self
32+
customButton.action = #selector(self.done)
33+
return customButton
34+
}
35+
2436
let barButtonItem = UIBarButtonItem(title: self.appearance.doneButtonTitle, style: .done, target: self, action: #selector(self.done))
2537
barButtonItem.tintColor = self.appearance.barButtonItemsColor
2638
barButtonItem.isEnabled = self.allowToChooseNilDate
@@ -526,5 +538,7 @@ extension FastisConfig {
526538
public var titleTextAttributes: [NSAttributedString.Key: Any] = [:]
527539
public var backgroundColor: UIColor = .white
528540
public var barButtonItemsColor: UIColor = .systemBlue
541+
public var customCancelButton: UIBarButtonItem?
542+
public var customDoneButton: UIBarButtonItem?
529543
}
530544
}

0 commit comments

Comments
 (0)