Skip to content

Commit

Permalink
Merge pull request #4 from wojteklembryk/master
Browse files Browse the repository at this point in the history
Custom cancel and done buttons
  • Loading branch information
ilia3546 authored Sep 25, 2020
2 parents 005b4a9 + 217e852 commit 6669cb9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Fastis.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Fastis'
s.version = '1.0.10'
s.version = '1.0.11'
s.summary = "Simple date picker created using JTAppleCalendar library"
s.description = <<-DESC
Fastis is a fully customizable UI component for picking dates and ranges created using JTAppleCalendar library.
Expand Down
14 changes: 14 additions & 0 deletions Source/Views/Controller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,24 @@ public class FastisController<Value: FastisValue>: UIViewController, JTACMonthVi
// MARK: - Outlets

private lazy var cancelBarButtonItem: UIBarButtonItem = {
if let customButton = self.appearance.customCancelButton {
customButton.target = self
customButton.action = #selector(self.cancel)
return customButton
}

let barButtonItem = UIBarButtonItem(title: self.appearance.cancelButtonTitle, style: .plain, target: self, action: #selector(self.cancel))
barButtonItem.tintColor = self.appearance.barButtonItemsColor
return barButtonItem
}()

private lazy var doneBarButtonItem: UIBarButtonItem = {
if let customButton = self.appearance.customDoneButton {
customButton.target = self
customButton.action = #selector(self.done)
return customButton
}

let barButtonItem = UIBarButtonItem(title: self.appearance.doneButtonTitle, style: .done, target: self, action: #selector(self.done))
barButtonItem.tintColor = self.appearance.barButtonItemsColor
barButtonItem.isEnabled = self.allowToChooseNilDate
Expand Down Expand Up @@ -526,5 +538,7 @@ extension FastisConfig {
public var titleTextAttributes: [NSAttributedString.Key: Any] = [:]
public var backgroundColor: UIColor = .white
public var barButtonItemsColor: UIColor = .systemBlue
public var customCancelButton: UIBarButtonItem?
public var customDoneButton: UIBarButtonItem?
}
}

0 comments on commit 6669cb9

Please sign in to comment.