Swiftpack.co - simla-tech/Fastis as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by simla-tech.
simla-tech/Fastis 2.3.0
🗓 Simple date range & date picker powered by JTAppleCalendar
⭐️ 160
🕓 13 weeks ago
.package(url: "https://github.com/simla-tech/Fastis.git", from: "2.3.0")

SwiftMP compatible CocoaPods compatible Swift Xcode License

Fastis is a fully customisable UI component for picking dates and ranges created using the JTAppleCalendar library.


  • iOS 13.0+
  • Xcode 11.0+
  • Swift 5.0+


  • ☑ Flexible customization
  • ☑ Shortcuts for dates and ranges
  • ☑ Single date and date range modes

Android implementation



CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Fastis into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '13.0'

target '<Your Target Name>' do
    pod 'Fastis', '~> 2.0'

Then, run the following command:

$ pod install

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding Fastis as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/simla-tech/Fastis.git", .upToNextMajor(from: "2.0.0"))


Carthage isn't supported.


If you prefer not to use either of the dependency managers mentioned above, you can manually integrate Fastis into your project.


Quick Start

import Fastis

class MyViewController: UIViewController {

    func chooseDate() {
        let fastisController = FastisController(mode: .range)
        fastisController.title = "Choose range"
        fastisController.maximumDate = Date()
        fastisController.allowToChooseNilDate = true
        fastisController.shortcuts = [.today, .lastWeek]
        fastisController.dismissHandler = { [weak self] action in
            switch action {
            case .done(let newValue):
            case .cancel:
        fastisController.present(above: self)


Single and range modes

If you want to get a single date, you have to use the Date type:

let fastisController = FastisController(mode: .single)
fastisController.initialValue = Date()
fastisController.dismissHandler = { [weak self] action in
    switch action {
    case .done(let resultDate):
        print(resultDate) // resultDate is Date
    case .cancel:

If you want to get a date range, you have to use the FastisRange type:

let fastisController = FastisController(mode: .range)
fastisController.initialValue = FastisRange(from: Date(), to: Date()) // or .from(Date(), to: Date())
fastisController.dismissHandler = { [weak self] action in
    switch action {
    case .done(let resultRange):
        print(resultRange) // resultRange is FastisRange
    case .cancel:


FastisController has the following default configuration parameters:

var shortcuts: [FastisShortcut<Value>] = []
var allowsToChooseNilDate: Bool = false
var dismissHandler: ((DismissAction) -> Void)? = nil
var initialValue: Value? = nil
var minimumDate: Date? = nil
var maximumDate: Date? = nil
var selectMonthOnHeaderTap: Bool = true
var allowDateRangeChanges: Bool = true
var closeOnSelectionImmediately: Bool = false
  • shortcuts- Shortcuts array. The default value is []. See Shortcuts section
  • allowsToChooseNilDate- Allow to choose nil date. If you set true, the done button will always be enabled. And in .single mode you can reset the date when you tapped on it again. The default value is false.
  • dismissHandler- The block to execute after the dismissal finishes. The default value is nil. Return DismissAction.done(FastisValue?) after the "Done" button will be tapped or DismissAction.cancel when controller dismissed without tapped the "Done" button.
  • initialValue- And initial value which will be selected by default. The default value is nil.
  • minimumDate- Minimal selection date. Dates less than current will be marked as unavailable. The default value is nil.
  • maximumDate- Maximum selection date. Dates more significant than current will be marked as unavailable. The default value is nil.
  • selectMonthOnHeaderTap (Only for .range mode) - Set this variable to true if you want to allow select date ranges by tapping on months. The default value is true.
  • allowDateRangeChanges (Only for .range mode) - Set this variable to false if you want to disable date range changes. Next tap after selecting a range will start a new range selection. The default value is true.
  • closeOnSelectionImmediately (Only for .single mode) - Set this variable to true if you want to hide view of the selected date and close the controller right after the date is selected. The default value is false


Using shortcuts allows you to select set dates or date ranges quickly. By default .shortcuts is empty. The bottom container will be hidden if you don't provide any shortcuts.

In Fastis available some prepared shortcuts for each mode:

  • For .single: .today, .tomorrow, .yesterday
  • For .range: .today, .lastWeek, .lastMonth

Also, you can create your own shortcut:

var customShortcut = FastisShortcut(name: "Today") {
    let now = Date()
    return FastisRange(from: now.startOfDay(), to: now.endOfDay())
fastisController.shortcuts = [customShortcut, .lastWeek]


Fastis can be customised global or local. FastisConfig have some sections:

  • calendar - Base calendar that used to render UI. Default value is .current
  • controller - base view controller (cancelButtonTitle, doneButtonTitle, etc.)
  • monthHeader - month titles
  • dayCell - day cells (selection parameters, font, etc.)
  • weekView - top header view with weekday names
  • currentValueView - current value view appearance (clear button, date format, etc.)
  • shortcutContainerView - bottom view with shortcuts
  • shortcutItemView - shortcut item in the bottom view

To customise all Fastis controllers in your app, use FastisConfig.default:

FastisConfig.default.monthHeader.labelColor = .red

To customise a special FastisController instance:

var customConfig = FastisConfig.default
customConfig.controller.dayCell.dateLabelColor = .blue
let fastisController = FastisController(mode: .range, config: customConfig)



Fastis is released under the MIT license. See LICENSE for details.


Stars: 160
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

2.3.0 — Pest Control
13 weeks ago
  • Fix issue with arabic language #25
  • Fix some memory leaks #23
  • XCode 15 compatibility
  • Other little code improvements

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics