All Projects → WenchaoD → Fscalendar

WenchaoD / Fscalendar

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

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Fscalendar

Kvkcalendar
A most fully customization calendar and timeline library for iOS 📅
Stars: ✭ 160 (-98.37%)
Mutual labels:  cocoapods, carthage, calendar
Observable
The easiest way to observe values in Swift.
Stars: ✭ 346 (-96.48%)
Mutual labels:  library, cocoapods, carthage
Alertift
Swifty, modern UIAlertController wrapper.
Stars: ✭ 242 (-97.54%)
Mutual labels:  library, cocoapods, carthage
Koyomi
Simple customizable calendar component in Swift 📆
Stars: ✭ 716 (-92.72%)
Mutual labels:  cocoapods, carthage, calendar
Datez
📆 Breeze through Date, DateComponents, and TimeInterval with Swift!
Stars: ✭ 254 (-97.42%)
Mutual labels:  cocoapods, carthage, calendar
Loadingshimmer
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
Stars: ✭ 1,180 (-87.99%)
Mutual labels:  library, cocoapods, carthage
Pluggableappdelegate
!! No longer supported !! A lightweight service-oriented AppDelegate for iOS, made in Swift.
Stars: ✭ 96 (-99.02%)
Mutual labels:  cocoapods, carthage
Tkrubberindicator
A rubber animation pagecontrol
Stars: ✭ 1,337 (-86.4%)
Mutual labels:  cocoapods, carthage
Swiftcsvexport
Swift CSV Export is rich features framework and it helpful to read and write CSV in simple way.
Stars: ✭ 96 (-99.02%)
Mutual labels:  cocoapods, carthage
Puzzlemaker
Swift framework responsible for generating puzzles from the image
Stars: ✭ 99 (-98.99%)
Mutual labels:  cocoapods, carthage
Quick
The Swift (and Objective-C) testing framework.
Stars: ✭ 9,303 (-5.35%)
Mutual labels:  cocoapods, carthage
Cardsstack
An awesome set of cards at your disposal ✌️ ⚡️
Stars: ✭ 97 (-99.01%)
Mutual labels:  cocoapods, carthage
Nextgrowingtextview
📝 The next in the generations of 'growing textviews' optimized for iOS 8 and above.
Stars: ✭ 1,540 (-84.33%)
Mutual labels:  cocoapods, carthage
Swiftforms
A small and lightweight library written in Swift that allows you to easily create forms.
Stars: ✭ 1,329 (-86.48%)
Mutual labels:  cocoapods, carthage
Mscircularslider
A fully-featured, powerful circular slider for iOS applications
Stars: ✭ 94 (-99.04%)
Mutual labels:  library, cocoapods
Colormatchtabs
This is a Review posting app that let user find interesting places near them
Stars: ✭ 1,341 (-86.36%)
Mutual labels:  cocoapods, carthage
Cocoapods Playgrounds
🃏 Generate Swift Playgrounds for any library.
Stars: ✭ 1,307 (-86.7%)
Mutual labels:  cocoapods, carthage
Predicateflow
Write amazing, strong-typed and easy-to-read NSPredicate.
Stars: ✭ 98 (-99%)
Mutual labels:  library, cocoapods
Datepicker
A Date Picker with Calendar for iPhone and iPad Apps.
Stars: ✭ 103 (-98.95%)
Mutual labels:  library, cocoapods
Rdgliderviewcontroller Swift
Control for a floating view gliding over a ViewController Edit
Stars: ✭ 102 (-98.96%)
Mutual labels:  cocoapods, carthage

logo

Apps Using Total Downloads
Travis Version Platform Carthage compatible
Languages

Table of contents

Screenshots

iPhone

fscalendar

iPad

fscalendar-ipad

Safe Orientation

fscalendar-scope-orientation-autolayout

Today Extension

iOS8/9 iOS10
today1 today2

Interactive Scope Gesture

1

DIY support

1

To customize your own cell, view DIY Example in Example-Swift or Example-Objc

Swipe-To-Choose

Single-Selection
Swipe-To-Choose
Multiple-Selection
Swipe-To-Choose
DIY
Swipe-To-Choose
1 2 3

Achievement of Users

1 2 3 4

More Achievements are available in FSCalendar Gallery

Installation

CocoaPods:

  • For iOS8+: 👍
use_frameworks!
target '<Your Target Name>' do
    pod 'FSCalendar'
end
  • For iOS7+:
target '<Your Target Name>' do
	pod 'FSCalendar'
end

NSCalendarExtension is required to get iOS7 compatibility.

Carthage:

  • For iOS8+
github "WenchaoD/FSCalendar"

SPM:

Add dependency:

.package(url: "https://github.com/WenchaoD/FSCalendar.git", from: "2.8.3")

Manually:

  • Drag all files under FSCalendar folder into your project. 👍

Alternatively to give it a test run, simply press command+u in Example-Objc or Example-Swift and launch the UITest Target.
Only the methods marked "👍" support IBInspectable / IBDesignable feature. Have fun with Interface builder

Setup

Use Interface Builder

1、 Drag an UIView object to ViewController Scene 2、 Change the Custom Class to FSCalendar
3、 Link dataSource and delegate to the ViewController

fscalendar-ib

4、 Finally, implement FSCalendarDataSource and FSCalendarDelegate in your ViewController

Or use code

@property (weak , nonatomic) FSCalendar *calendar;
// In loadView(Recommended) or viewDidLoad
FSCalendar *calendar = [[FSCalendar alloc] initWithFrame:CGRectMake(0, 0, 320, 300)];
calendar.dataSource = self;
calendar.delegate = self;
[self.view addSubview:calendar];
self.calendar = calendar;

Or swift

fileprivate weak var calendar: FSCalendar!
// In loadView or viewDidLoad
let calendar = FSCalendar(frame: CGRect(x: 0, y: 0, width: 320, height: 300))
calendar.dataSource = self
calendar.delegate = self
view.addSubview(calendar)
self.calendar = calendar

To use FSCalendar in Swift3, see Example-Swift for details.

Warning

FSCalendar doesn't update frame by itself, Please implement

  • For AutoLayout
- (void)calendar:(FSCalendar *)calendar boundingRectWillChange:(CGRect)bounds animated:(BOOL)animated
{
    self.calendarHeightConstraint.constant = CGRectGetHeight(bounds);
    // Do other updates here
    [self.view layoutIfNeeded];
}
  • For Manual Layout
- (void)calendar:(FSCalendar *)calendar boundingRectWillChange:(CGRect)bounds animated:(BOOL)animated
{
    calendar.frame = (CGRect){calendar.frame.origin,bounds.size};
    // Do other updates here
}
  • If you are using Masonry
- (void)calendar:(FSCalendar *)calendar boundingRectWillChange:(CGRect)bounds animated:(BOOL)animated
{
    [calendar mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@(bounds.size.height));
        // Do other updates
    }];
    [self.view layoutIfNeeded];
}
  • If you are using SnapKit
func calendar(_ calendar: FSCalendar, boundingRectWillChange bounds: CGRect, animated: Bool) {
    calendar.snp.updateConstraints { (make) in
        make.height.equalTo(bounds.height)
        // Do other updates
    }
    self.view.layoutIfNeeded()
}

Roll with Interface Builder

fscalendar - ibdesignable

Pre-knowledge

In Swift3, NSDate and NSDateFormatter have been renamed to Date and DateFormatter , see Example-Swift for details.

How to create NSDate object

  • By NSCalendar.
self.gregorian = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];

Then:

NSDate *date = [gregorian dateWithEra:1 year:2016 month:9 day:10 hour:0 minute:0 second:0 nanosecond:0];
// 2016-09-10 00:00:00
  • Or by NSDateFormatter
self.formatter = [[NSDateFormatter alloc] init];
self.formatter.dateFormat = @"yyyy-MM-dd";

Then:

NSDate *date = [self.formatter dateFromString:@"2016-09-10"];

How to print out NSDate object

  • Use NSDateFormatter
self.formatter = [[NSDateFormatter alloc] init];
self.formatter.dateFormat = @"yyyy/MM/dd";
NSString *string = [self.formatter stringFromDate:date];
NSLog(@"Date is %@", string);

How to manipulate NSDate with NSCalendar

self.gregorian = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];
  • Get component of NSDate
NSInteger era = [self.gregorian component:NSCalendarUnitEra fromDate:date];
NSInteger year = [self.gregorian component:NSCalendarUnitYear fromDate:date];
NSInteger month = [self.gregorian component:NSCalendarUnitMonth fromDate:date];
NSInteger day = [self.gregorian component:NSCalendarUnitDay fromDate:date];
NSInteger hour = [self.gregorian component:NSCalendarUnitHour fromDate:date];
NSInteger minute = [self.gregorian component:NSCalendarUnitMinute fromDate:date];
...
  • Get next month
NSDate *nextMonth = [self.gregorain dateByAddingUnit:NSCalendarUnitMonth value:1 toDate:date options:0];
  • Get next day
NSDate *nextDay = [self.gregorain dateByAddingUnit:NSCalendarUnitDay value:1 toDate:date options:0];
  • Is date in today/tomorrow/yesterday/weekend
BOOL isToday = [self.gregorian isDateInToday:date];
BOOL isYesterday = [self.gregorian isDateInYesterday:date];
BOOL isTomorrow = [self.gregorian isDateInTomorrow:date];
BOOL isWeekend = [self.gregorian isDateInWeekend:date];
  • Compare two dates
BOOL sameDay = [self.gregorian isDate:date1 inSameDayAsDate:date2];
// Yes if the date1 and date2 are in same day


[self.gregorian compareDate:date1 toDate:date2 toUnitGranularity:unit];
// compare the era/year/month/day/hour/minute .etc ...
// return NSOrderAscending/NSOrderSame/NSOrderDecending

BOOL inSameUnit = [self.gregorian isDate:date1 equalToDate:date2 toUnitGranularity:unit];
// if the given unit (era/year/month/day/hour/minute .etc) are the same

Support this repo


* Support with  
* Support with or

Contact

If your made a beautiful calendar with this library in your app, please take a screen shot and @me in twitter. Your help really means a lot to me!

License

FSCalendar is available under the MIT license. See the LICENSE file for more info.

Documentation | More Usage | 简书

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].