Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saeid/GDCalendar
Calendar component with RTL languages written in swift
https://github.com/saeid/GDCalendar
calendar component locale persian-calendar swift swift4
Last synced: 7 days ago
JSON representation
Calendar component with RTL languages written in swift
- Host: GitHub
- URL: https://github.com/saeid/GDCalendar
- Owner: saeid
- License: mit
- Created: 2017-04-12T19:47:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-27T07:49:11.000Z (over 5 years ago)
- Last Synced: 2024-11-29T11:04:01.928Z (14 days ago)
- Topics: calendar, component, locale, persian-calendar, swift, swift4
- Language: Swift
- Homepage:
- Size: 403 KB
- Stars: 26
- Watchers: 4
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - GDPersianCalendar - Customizable and easy to use Persian Calendar component. (UI / Calendar)
- awesome-ios-star - GDPersianCalendar - Customizable and easy to use Persian Calendar component. (UI / Calendar)
README
# GDCalendar
Calendar component with both RTL/LTR languages support with Swipe Gesture enabled navigation.
Easy to use with Storyboard and Attributes Inspector support.## Requirements
- Xcode 10+
- Swift 4+
- iOS 8+# Installation
## Cocoapods
```
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!target '' do
pod 'GDCalendar'
end
```
pod update
pod install## Usage
```swift
import GDCalendar
```Set To Desire Locale Calendar
```swift
// Persian Calendar Locale: fa_IR
UserDefaults.standard.set("fa_IR", forKey: "current_locale")// List of available iOS locale names
// https://gist.github.com/jacobbubu/1836273/*
If `current_locale` is not set, default phone calendar will be selected
*/
```## Code
```swift
let calendar = GDTextSlot(frame: view.bounds)
view.addSubview(calendar)
```Set Properties
```swift
// Days view items color
calendar.headerItemColor = UIColor.white
// Main calendar items text color
calendar.itemsColor = UIColor.black
// Header view items font
calendar.headersFont = UIFont.boldSystemFont(ofSize: 13)// Calendar items font
calendar.itemsFont = UIFont.systemFont(ofSize: 15)
// Full properties list can be found on sample project```
Set Date Selection Closure
```swift
calendar.dateSelectHandler = { [weak self] selectedDate in
print(selectedDate)// Get Date Components
let day = date.dayName
let month = date.monthName
let components = date.componentsOfDate
print("\(components.year) / \(components.month) / \(components.day)")
}
```## Storyboard
1) Add `UIView` to storyboard, set custom class to `GDCalendar`
2) Set attributes with `Attribute Inspector`## Licence
GDCalendar is available under the MIT license. See the [LICENSE.txt](https://github.com/saeid/GDCalendar/blob/master/LICENSE) file for more info.