A calendar control for iOS written in swift with mvvm pattern

Related tags

Calendar ASCalendar
Overview

ASCalendar

alt tag

try it on appetize

Installation

CocoaPods

You can use CocoaPods to install ASCalendar by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'ASCalendar'

To get the full benefits import ASCalendar wherever you import UIKit

import UIKit
import ASCalendar

Manually

  1. Download and drop /Example/Calendar folder in your project.
  2. Congratulations!

implementation :

  • To show a calendar in your current window simply add:
    let calendar = ASCalendar()
    calendar.showCalendarAsLayer()
  • To check what day the user has selected use the ASCalendarDelegate (like in the example):
    calendar.delegate = self
    func calendarSelect(day: Int, week: Int, month: Int, year: Int) {
        NSLog("%d-%d-%d (%d)", day, month, year, week)
    }

-to close the calendar the user can tap outside it (like a popover) or you can manually close it calling:

    calendar.hideCalendar()

settings :

  • By defaul ASCalendar is set to give a day selection but you can also switch to week mode (in any time):
    calendar.setSelectionStyle(.Week)
  • As italian I'm used to start the week with monday, but you can set to display sunday as first day in this way:
    calendar.setSundayFirstWeekDay(true)
    //or
    calendar.setMondayFirstWeekDay(false)
  • to set a specific month-year to show, you can use at any time:
    //month: 06, year: 2035
    calendar.setcurrentPage(6, year: 2035)
  • you can also set a specific interval in witch the user can select a day, disabling all the other days:
    //the range will start by day:15 month: 02, year: 2018
    calendar.setFirstSelectableDate(15, month: 2, year: 2018)
    //the upper limit of the selectable range will be day:20 month: 02, year: 2018
    calendar.setLastSelectableDate(20, month: 2, year: 2018)
  • than, of course, you can set a specific day/week manually in this way:
    //set day or week selected by day:13 month: 04, year: 2044
    calendar.setSelectedDay(13, month: 04, year: 2044)

customisations :

  • You can customize the colors, the fonts, and set specific selection sizes of this calendar. In general the customisations functions start by "calendar.configure...". You should customize the calendar before showing it.
  func configureHeader(backgroundColor: UIColor?, textColor: UIColor?, textFont : UIFont?, separationLineColor: UIColor?)
  func configureBodyHeader(backgroundColor: UIColor?, textColor: UIColor?, textFont: UIFont?, separationLineColor: UIColor?)
  func configureBody(backgroundColor: UIColor?, monthTextColor: UIColor?, monthTextFont: UIFont?, separationLineColor: UIColor?)
  func configureDay(selectableTextColor: UIColor?, unselectableTextColor: UIColor?, selectedTextColor: UIColor?, TextFont: UIFont?)
  func configureSelections(selectionColor: UIColor?, daySelectionSize: CGFloat?, weekSelectionHeight: CGFloat?)
  • There are also 4 defaults theme you can easily set with :
  calendar.theme.defaults(index)

licence :

Copyright (c) 2016 Alberto Scampini

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
An Easy to Use Calendar for iOS (Swift 5.0)
An Easy to Use Calendar for iOS (Swift 5.0)

This is an easy to use, "just drag and drop it in your code" type of calendar for iOS. It supports both vertical and horizontal scrolling, as well as

A fully customizable iOS calendar library, compatible with Objective-C and Swift
A fully customizable iOS calendar library, compatible with Objective-C and Swift

Table of contents Screenshots Installation Pre-knowledge Support Contact Screenshots iPhone iPad Safe Orientation Today Extension iOS8/9 iOS10 Interac

CalendarApp Swift - Made a calendar app in swift, completely from scratch using UIStackView and UICollectionView
CalendarApp Swift - Made a calendar app in swift, completely from scratch using UIStackView and UICollectionView

CalendarApp_Swift Made a calendar app in swift, completely from scratch using UI

SwiftUI Simple Calendar / Date Picker for iOS
SwiftUI Simple Calendar / Date Picker for iOS

RKCalendar RKCalendar is a SwiftUI Calendar / Date Picker for iOS. Features include: minimum and maximum calendar dates selectable, single date select

iOS 7+ Calendar (Date Picker) with Infinite Scrolling.
iOS 7+ Calendar (Date Picker) with Infinite Scrolling.

RSDayFlow iOS 7 Calendar with Infinite Scrolling. Only need 4 lines of code to set up. RSDayFlow is a slim fork of DayFlow with updates and extensions

An availability calendar implementation for iOS
An availability calendar implementation for iOS

NWCalendarView NWCalendar View is an iOS control that displays a calendar. It is perfect for appointment or availibilty selection. It allows for selec

A customizable calendar view for iOS.
A customizable calendar view for iOS.

JTCalendar JTCalendar is an easily customizable calendar control for iOS. Installation With CocoaPods, add this line to your Podfile. pod 'JTCalendar'

An open source calendar framework for iOS, with support for customization, IBDesignable, Autolayout, and more.
An open source calendar framework for iOS, with support for customization, IBDesignable, Autolayout, and more.

About MBCalendarKit is a calendar control written in Objective-C with modern best practices and Swift interoperability in mind. It offers a flexible c

A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.
A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.

A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.

Comments
  • Access Just Calendar View

    Access Just Calendar View

    Nice framework! Curious, tinkered around with it and doesn't seem you can easily initialize and access just the calendar's view. i,e: not show it modally with animation. I'd like to get a reference of the view I can use with addSubview() or render it to an image to manipulate etc..Thanks again.

    opened by skram 1
Owner
Alberto Scampini
Alberto Scampini
A calendar control for iOS written in swift with mvvm pattern

ASCalendar try it on appetize Installation CocoaPods You can use CocoaPods to install ASCalendar by adding it to your Podfile: platform :ios, '8.0' us

Alberto Scampini 192 Jun 26, 2022
A declarative, performant, iOS calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-featured calendar apps.

HorizonCalendar A declarative, performant, calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-feat

Airbnb 2.2k Jan 4, 2023
Simple customizable calendar component in Swift :calendar:

Koyomi Koyomi is a simple calendar view framework for iOS, written in Swift ?? Content Features Demo App Usage introduction : Change displayed month,

Shohei Yokoyama 741 Dec 24, 2022
Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events

Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events. It will gather events from your default iOS calendar.

Chase 194 Jan 4, 2023
📆 An elegant calendar control for iOS.

NO LONGER MAINTAINED Daysquare An elegant calendar control for iOS. Introduction Get bored with native silly UIDatePicker? You may have a try on this

Cyandev 701 Sep 9, 2022
Calendar View - It's lightweight and simple control with supporting Locale and CalendarIdentifier.

iOS Calendar It's lightweight and simple control with supporting Locale and CalendarIdentifier. There're samples for iPhone and iPad, and also with us

Maksym Bilan 159 Dec 22, 2022
A custom visual calendar for iOS 8+ written in Swift (>= 4.0).

Overview Screenshots GIF Demo Installation Usage Architecture Version matrix Advanced API For contributors Screenshots GIF Demo Installation CocoaPods

null 3.5k Dec 24, 2022
Calendar component with RTL languages written in swift

GDCalendar Calendar component with both RTL/LTR languages support with Swipe Gesture enabled navigation. Easy to use with Storyboard and Attributes In

Saeid 26 Jul 17, 2022
Clendar - universal calendar app. Written in SwiftUI. Available on App Store. MIT License.

Clendar - minimal calendar Minimal Calendar & Widgets Landing Page About This project is started out as an UIKit base app for me to learn new WWDC fea

Vinh Nguyen 418 Dec 30, 2022
📅 Calendar for iOS, iPadOS and macOS in Swift

CalendarKit CalendarKit is a Swift calendar UI library for iOS, iPadOS and Mac Catalyst. It looks similar to the Apple Calendar app out-of-the-box, wh

Richard Topchii 2.2k Jan 5, 2023