Skip to content

Commit

Permalink
Decouples
Browse files Browse the repository at this point in the history
  • Loading branch information
WenchaoD committed Oct 29, 2016
1 parent be6c807 commit 03e688f
Show file tree
Hide file tree
Showing 22 changed files with 580 additions and 1,653 deletions.
File renamed without changes.
14 changes: 12 additions & 2 deletions Example/FSCalendar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
30024F951BD1015300B1C04C /* DelegateAppearanceViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 30024F941BD1015300B1C04C /* DelegateAppearanceViewController.m */; };
30145EF11D6D754D00AA5F72 /* FSCalendarTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EE638CF51B8A1F550006DD1A /* FSCalendarTests.m */; };
301F93451D8802D90028BEC8 /* FSCalendarExtensionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 301F93441D8802D90028BEC8 /* FSCalendarExtensionTest.m */; };
303105F31DC241D9002F802F /* FSCalendarDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 303105F11DC241D9002F802F /* FSCalendarDelegateProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
303105F41DC241D9002F802F /* FSCalendarDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 303105F21DC241D9002F802F /* FSCalendarDelegateProxy.m */; };
303105F51DC241D9002F802F /* FSCalendarDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 303105F21DC241D9002F802F /* FSCalendarDelegateProxy.m */; };
3031F3EF1CDEDFC500C174D7 /* ScopeHandleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3031F3EE1CDEDFC500C174D7 /* ScopeHandleViewController.m */; };
3055B1C21DA9323A002AFA13 /* FSCalendarExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3055B1C01DA9323A002AFA13 /* FSCalendarExtensions.h */; settings = {ATTRIBUTES = (Private, ); }; };
3055B1C31DA9323A002AFA13 /* FSCalendarExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3055B1C11DA9323A002AFA13 /* FSCalendarExtensions.m */; };
Expand Down Expand Up @@ -101,6 +104,8 @@
30024F931BD1015300B1C04C /* DelegateAppearanceViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DelegateAppearanceViewController.h; sourceTree = SOURCE_ROOT; };
30024F941BD1015300B1C04C /* DelegateAppearanceViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DelegateAppearanceViewController.m; sourceTree = SOURCE_ROOT; };
301F93441D8802D90028BEC8 /* FSCalendarExtensionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarExtensionTest.m; sourceTree = "<group>"; };
303105F11DC241D9002F802F /* FSCalendarDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarDelegateProxy.h; sourceTree = "<group>"; };
303105F21DC241D9002F802F /* FSCalendarDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarDelegateProxy.m; sourceTree = "<group>"; };
3031F3ED1CDEDFC500C174D7 /* ScopeHandleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopeHandleViewController.h; sourceTree = SOURCE_ROOT; };
3031F3EE1CDEDFC500C174D7 /* ScopeHandleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScopeHandleViewController.m; sourceTree = SOURCE_ROOT; };
3055B1C01DA9323A002AFA13 /* FSCalendarExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarExtensions.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -219,6 +224,8 @@
30B0BAC01B8D8E22004B9476 /* FSCalendar.m */,
30B0BAC11B8D8E22004B9476 /* FSCalendarAppearance.h */,
30B0BAC21B8D8E22004B9476 /* FSCalendarAppearance.m */,
303105F11DC241D9002F802F /* FSCalendarDelegateProxy.h */,
303105F21DC241D9002F802F /* FSCalendarDelegateProxy.m */,
309225381B905C4300123031 /* FSCalendarConstants.h */,
309225391B905C4300123031 /* FSCalendarConstants.m */,
3065CA941CD31B81006C218D /* FSCalendarScopeHandle.h */,
Expand Down Expand Up @@ -390,6 +397,7 @@
30B0BAFC1B8D9AD4004B9476 /* FSCalendar.h in Headers */,
30B0BB011B8D9B6C004B9476 /* FSCalendarAppearance.h in Headers */,
3092253A1B905C4300123031 /* FSCalendarConstants.h in Headers */,
303105F31DC241D9002F802F /* FSCalendarDelegateProxy.h in Headers */,
30B0BB021B8D9B6C004B9476 /* FSCalendarCell.h in Headers */,
30B0BB041B8D9B6D004B9476 /* FSCalendarHeader.h in Headers */,
EEC9C0391BDC9E7000383A07 /* FSCalendarCollectionView.h in Headers */,
Expand Down Expand Up @@ -563,6 +571,7 @@
3065CA971CD31B81006C218D /* FSCalendarScopeHandle.m in Sources */,
308B58D81CC08FFA004E812D /* ButtonsViewController.m in Sources */,
EE638CCB1B89DBAC0006DD1A /* main.m in Sources */,
303105F41DC241D9002F802F /* FSCalendarDelegateProxy.m in Sources */,
30B0BAD11B8D8E23004B9476 /* FSCalendarAppearance.m in Sources */,
30CEF9011C950C1F008EAFB1 /* FSCalendarAnimator.m in Sources */,
EEC9C03A1BDC9E7000383A07 /* FSCalendarCollectionView.m in Sources */,
Expand All @@ -582,6 +591,7 @@
files = (
30F5D8561B9FC33400C1C201 /* FSCalendar.m in Sources */,
30B0BAF61B8D9AC1004B9476 /* FSCalendarAppearance.m in Sources */,
303105F51DC241D9002F802F /* FSCalendarDelegateProxy.m in Sources */,
EEC9C03B1BDC9E7000383A07 /* FSCalendarCollectionView.m in Sources */,
3065CAA91CD3506A006C218D /* FSCalendar+Deprecated.m in Sources */,
30B0BAF71B8D9AC1004B9476 /* FSCalendarCell.m in Sources */,
Expand Down Expand Up @@ -699,7 +709,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -739,7 +749,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
Expand Down
6 changes: 5 additions & 1 deletion Example/LoadViewExampleViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
#import <UIKit/UIKit.h>
#import "FSCalendar.h"

NS_ASSUME_NONNULL_BEGIN

@interface LoadViewExampleViewController : UIViewController<FSCalendarDataSource, FSCalendarDelegate>

@property (weak, nonatomic) FSCalendar *calendar;

@property (strong, nonatomic) NSDateFormatter *dateFormatter;
@property (strong, nonatomic) NSDictionary *images;
@property (strong, nonatomic) NSDictionary<NSString *, UIImage *> *images;

@end

NS_ASSUME_NONNULL_END
16 changes: 8 additions & 8 deletions Example/LoadViewExampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// FSCalendar
//
// Created by DingWenchao on 6/25/15.
// Copyright (c) 2015 =. All rights reserved.
// Copyright (c) 2016 =. All rights reserved.
//

#import "LoadViewExampleViewController.h"
Expand All @@ -17,10 +17,10 @@ - (instancetype)init
self = [super init];
if (self) {
self.title = @"FSCalendar";
self.images = @{@"2015/02/01":[UIImage imageNamed:@"icon_cat"],
@"2015/02/05":[UIImage imageNamed:@"icon_footprint"],
@"2015/02/20":[UIImage imageNamed:@"icon_cat"],
@"2015/03/07":[UIImage imageNamed:@"icon_footprint"]};
self.images = @{@"2016/02/01":[UIImage imageNamed:@"icon_cat"],
@"2016/02/05":[UIImage imageNamed:@"icon_footprint"],
@"2016/02/20":[UIImage imageNamed:@"icon_cat"],
@"2016/03/07":[UIImage imageNamed:@"icon_footprint"]};
}
return self;
}
Expand Down Expand Up @@ -50,7 +50,7 @@ - (void)viewDidLoad
self.dateFormatter.dateFormat = @"yyyy/MM/dd";


[self.calendar selectDate:[self.dateFormatter dateFromString:@"2015/02/03"]];
// [self.calendar selectDate:[self.dateFormatter dateFromString:@"2016/02/03"]];

/*
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
Expand Down Expand Up @@ -97,12 +97,12 @@ - (void)calendar:(FSCalendar *)calendar boundingRectWillChange:(CGRect)bounds an

- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
{
return [self.dateFormatter dateFromString:@"2015/01/01"];
return [self.dateFormatter dateFromString:@"2016/10/01"];
}

- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
{
return [self.dateFormatter dateFromString:@"2015/10/10"];
return [self.dateFormatter dateFromString:@"2017/10/10"];
}


Expand Down
2 changes: 1 addition & 1 deletion Example/StoryboardExampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ - (NSInteger)calendar:(FSCalendar *)calendar numberOfEventsForDate:(NSDate *)dat

- (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar
{
return [self.dateFormatter1 dateFromString:@"2016/02/01"];
return [self.dateFormatter1 dateFromString:@"2016/12/01"];
}

- (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar
Expand Down
4 changes: 2 additions & 2 deletions FSCalendar.podspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Pod::Spec.new do |s|

s.name = "FSCalendar"
s.version = "2.4.0"
s.summary = "A superiorly awesome iOS7+ calendar control, compatible with both Objective-C and Swift."
s.version = "2.5.0"
s.summary = "A superiorly awesome iOS7+ calendar control, compatible with Objective-C and Swift."

s.homepage = "https://github.com/WenchaoD/FSCalendar"
s.screenshots = "https://cloud.githubusercontent.com/assets/5186464/10262249/4fabae40-69f2-11e5-97ab-afbacd0a3da2.jpg"
Expand Down
20 changes: 20 additions & 0 deletions FSCalendar/FSCalendar+Deprecated.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "FSCalendar.h"
#import "FSCalendarExtensions.h"
#import "FSCalendarDynamicHeader.h"

#pragma mark - Deprecate
Expand Down Expand Up @@ -290,5 +291,24 @@ - (BOOL)isDateInToday:(NSDate *)date
return [self isDate:date equalToDate:[NSDate date] toCalendarUnit:FSCalendarUnitDay];
}

- (void)setIdentifier:(NSString *)identifier
{
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:identifier];
[self setValue:gregorian forKey:@"gregorian"];
[self fs_performSelector:NSSelectorFromString(@"invalidateDateTools") withObjects:nil, nil];
[self fs_performSelector:NSSelectorFromString(@"invalidateWeekdaySymbols") withObjects:nil, nil];

if ([[self valueForKey:@"hasValidateVisibleLayout"] boolValue]) {
[self reloadData];
}
[self fs_setVariable:[self.gregorian dateBySettingHour:0 minute:0 second:0 ofDate:self.minimumDate options:0] forKey:@"_minimumDate"];
[self fs_setVariable:[self.gregorian dateBySettingHour:0 minute:0 second:0 ofDate:self.currentPage options:0] forKey:@"_currentPage"];
[self fs_performSelector:NSSelectorFromString(@"scrollToPageForDate:animated") withObjects:self.today, @NO, nil];
}

- (NSString *)identifier
{
return self.gregorian.calendarIdentifier;
}

@end
5 changes: 2 additions & 3 deletions FSCalendar/FSCalendar.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
@class FSCalendar;

/**
* FSCalendarDataSource is a source set of FSCalendar. The basic job is to provide event、subtitle and min/max day to display for calendar.
* FSCalendarDataSource is a source set of FSCalendar. The basic role is to provide event、subtitle and min/max day to display for calendar.
*/
@protocol FSCalendarDataSource <NSObject>

Expand Down Expand Up @@ -496,7 +496,6 @@ IB_DESIGNABLE
@end



#pragma mark - Deprecate

@interface FSCalendar (Deprecated)
Expand All @@ -506,7 +505,7 @@ IB_DESIGNABLE
- (void)setSelectedDate:(NSDate *)selectedDate FSCalendarDeprecated(-selectDate:);
- (void)setSelectedDate:(NSDate *)selectedDate animate:(BOOL)animate FSCalendarDeprecated(-selectDate:scrollToDate:);

@property (strong, nonatomic) NSString *identifier DEPRECATED_MSG_ATTRIBUTE("Changing calendar identifier is NOT RECOMMENDED. You should always use this library as a Gregorian calendar. Try to express other calendar as subtitles just as System calendar app does."); // Deprecated in 2.3.1
@property (strong, nonatomic) NSString *identifier DEPRECATED_MSG_ATTRIBUTE("Changing calendar identifier is NOT RECOMMENDED. ");

// Use NSDateFormatter
- (NSString *)stringFromDate:(NSDate *)date format:(NSString *)format FSCalendarDeprecated([NSDateFormatter stringFromDate:]);
Expand Down
Loading

0 comments on commit 03e688f

Please sign in to comment.