├── Images ├── 14Days.png └── 365Days.png ├── Pods ├── Headers │ ├── Private │ │ └── PureLayout │ │ │ ├── PureLayout.h │ │ │ ├── ALView+PureLayout.h │ │ │ ├── PureLayoutDefines.h │ │ │ ├── NSArray+PureLayout.h │ │ │ ├── PureLayout+Internal.h │ │ │ └── NSLayoutConstraint+PureLayout.h │ └── Public │ │ └── PureLayout │ │ ├── PureLayout.h │ │ ├── ALView+PureLayout.h │ │ ├── NSArray+PureLayout.h │ │ ├── PureLayoutDefines.h │ │ ├── PureLayout+Internal.h │ │ └── NSLayoutConstraint+PureLayout.h ├── Target Support Files │ ├── Pods-EFCalendarGraph-PureLayout │ │ ├── Pods-EFCalendarGraph-PureLayout.xcconfig │ │ ├── Pods-EFCalendarGraph-PureLayout-prefix.pch │ │ ├── Pods-EFCalendarGraph-PureLayout.modulemap │ │ ├── Pods-EFCalendarGraph-PureLayout-dummy.m │ │ ├── Pods-EFCalendarGraph-PureLayout-umbrella.h │ │ ├── Pods-EFCalendarGraph-PureLayout-Private.xcconfig │ │ └── Info.plist │ └── Pods-EFCalendarGraph │ │ ├── Pods-EFCalendarGraph.modulemap │ │ ├── Pods-EFCalendarGraph-dummy.m │ │ ├── Pods-EFCalendarGraph-umbrella.h │ │ ├── Pods-EFCalendarGraph-environment.h │ │ ├── Pods-EFCalendarGraph.debug.xcconfig │ │ ├── Pods-EFCalendarGraph.release.xcconfig │ │ ├── Info.plist │ │ ├── Pods-EFCalendarGraph-acknowledgements.markdown │ │ ├── Pods-EFCalendarGraph-acknowledgements.plist │ │ ├── Pods-EFCalendarGraph-frameworks.sh │ │ └── Pods-EFCalendarGraph-resources.sh ├── Manifest.lock ├── Pods.xcodeproj │ └── xcuserdata │ │ └── eliot.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ ├── Pods-EFCalendarGraph.xcscheme │ │ └── Pods-EFCalendarGraph-PureLayout.xcscheme └── PureLayout │ ├── LICENSE │ ├── PureLayout │ └── PureLayout │ │ ├── PureLayout.h │ │ ├── NSLayoutConstraint+PureLayout.h │ │ ├── PureLayout+Internal.h │ │ ├── NSArray+PureLayout.h │ │ ├── NSLayoutConstraint+PureLayout.m │ │ ├── PureLayoutDefines.h │ │ ├── ALView+PureLayout.h │ │ └── NSArray+PureLayout.m │ └── README.md ├── Podfile ├── Podfile.lock ├── EFCalendarGraph.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── eliot.xcuserdatad │ │ └── WorkspaceSettings.xcsettings ├── xcuserdata │ └── eliot.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── EFCalendarGraph.xcscheme └── project.pbxproj ├── EFCalendarGraph ├── ViewController.h ├── AppDelegate.h ├── main.m ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── EFCalendarGraph.h ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.xib ├── ViewController.m ├── Info.plist ├── AppDelegate.m ├── NSDate+Utilities.h ├── EFCalendarGraph.m └── NSDate+Utilities.m ├── EFCalendarGraph.xcworkspace └── contents.xcworkspacedata ├── EFCalendarGraphTests ├── Info.plist └── EFCalendarGraphTests.m ├── .gitignore └── README.md /Images/14Days.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eliotfowler/EFCalendarGraph/HEAD/Images/14Days.png -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/PureLayout.h -------------------------------------------------------------------------------- /Pods/Headers/Public/PureLayout/PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/PureLayout.h -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph-PureLayout/Pods-EFCalendarGraph-PureLayout.xcconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Images/365Days.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eliotfowler/EFCalendarGraph/HEAD/Images/365Days.png -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/ALView+PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/ALView+PureLayout.h -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/PureLayoutDefines.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/PureLayoutDefines.h -------------------------------------------------------------------------------- /Pods/Headers/Public/PureLayout/ALView+PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/ALView+PureLayout.h -------------------------------------------------------------------------------- /Pods/Headers/Public/PureLayout/NSArray+PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/NSArray+PureLayout.h -------------------------------------------------------------------------------- /Pods/Headers/Public/PureLayout/PureLayoutDefines.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/PureLayoutDefines.h -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/NSArray+PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/NSArray+PureLayout.h -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/PureLayout+Internal.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/PureLayout+Internal.h -------------------------------------------------------------------------------- /Pods/Headers/Public/PureLayout/PureLayout+Internal.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/PureLayout+Internal.h -------------------------------------------------------------------------------- /Pods/Headers/Private/PureLayout/NSLayoutConstraint+PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/NSLayoutConstraint+PureLayout.h -------------------------------------------------------------------------------- /Pods/Headers/Public/PureLayout/NSLayoutConstraint+PureLayout.h: -------------------------------------------------------------------------------- 1 | ../../../PureLayout/PureLayout/PureLayout/NSLayoutConstraint+PureLayout.h -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | use_frameworks! 3 | 4 | platform :ios, "8.0" 5 | 6 | target "EFCalendarGraph" do 7 | 8 | pod "PureLayout" 9 | 10 | end 11 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PureLayout (2.0.6) 3 | 4 | DEPENDENCIES: 5 | - PureLayout 6 | 7 | SPEC CHECKSUMS: 8 | PureLayout: f25f0bb904d5ccfe6e31da3cb869185259f02e0d 9 | 10 | COCOAPODS: 0.37.2 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph-PureLayout/Pods-EFCalendarGraph-PureLayout-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-EFCalendarGraph-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PureLayout (2.0.6) 3 | 4 | DEPENDENCIES: 5 | - PureLayout 6 | 7 | SPEC CHECKSUMS: 8 | PureLayout: f25f0bb904d5ccfe6e31da3cb869185259f02e0d 9 | 10 | COCOAPODS: 0.37.2 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_EFCalendarGraph { 2 | umbrella header "Pods-EFCalendarGraph-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_EFCalendarGraph : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_EFCalendarGraph 5 | @end 6 | -------------------------------------------------------------------------------- /EFCalendarGraph.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph-PureLayout/Pods-EFCalendarGraph-PureLayout.modulemap: -------------------------------------------------------------------------------- 1 | framework module PureLayout { 2 | umbrella header "Pods-EFCalendarGraph-PureLayout-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | FOUNDATION_EXPORT double Pods_EFCalendarGraphVersionNumber; 5 | FOUNDATION_EXPORT const unsigned char Pods_EFCalendarGraphVersionString[]; 6 | 7 | -------------------------------------------------------------------------------- /EFCalendarGraph/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // EFCalendarGraph 4 | // 5 | // Created by Eliot Fowler on 7/6/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph-PureLayout/Pods-EFCalendarGraph-PureLayout-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_EFCalendarGraph_PureLayout : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_EFCalendarGraph_PureLayout 5 | @end 6 | -------------------------------------------------------------------------------- /EFCalendarGraph.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /EFCalendarGraph/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // EFCalendarGraph 4 | // 5 | // Created by Eliot Fowler on 7/6/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /EFCalendarGraph/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // EFCalendarGraph 4 | // 5 | // Created by Eliot Fowler on 7/6/15. 6 | // 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /EFCalendarGraph.xcodeproj/project.xcworkspace/xcuserdata/eliot.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph-PureLayout/Pods-EFCalendarGraph-PureLayout-umbrella.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "ALView+PureLayout.h" 4 | #import "NSArray+PureLayout.h" 5 | #import "NSLayoutConstraint+PureLayout.h" 6 | #import "PureLayout+Internal.h" 7 | #import "PureLayout.h" 8 | #import "PureLayoutDefines.h" 9 | 10 | FOUNDATION_EXPORT double PureLayoutVersionNumber; 11 | FOUNDATION_EXPORT const unsigned char PureLayoutVersionString[]; 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // PureLayout 10 | #define COCOAPODS_POD_AVAILABLE_PureLayout 11 | #define COCOAPODS_VERSION_MAJOR_PureLayout 2 12 | #define COCOAPODS_VERSION_MINOR_PureLayout 0 13 | #define COCOAPODS_VERSION_PATCH_PureLayout 6 14 | 15 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_FRAMEWORK_BUILD_PATH" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/PureLayout.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -framework "PureLayout" 6 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-EFCalendarGraph 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_FRAMEWORK_BUILD_PATH" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_FRAMEWORK_BUILD_PATH/PureLayout.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -framework "PureLayout" 6 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-EFCalendarGraph 8 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph-PureLayout/Pods-EFCalendarGraph-PureLayout-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-EFCalendarGraph-PureLayout.xcconfig" 2 | CONFIGURATION_BUILD_DIR = $PODS_FRAMEWORK_BUILD_PATH 3 | FRAMEWORK_SEARCH_PATHS = "$PODS_FRAMEWORK_BUILD_PATH" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PureLayout" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PureLayout" 6 | OTHER_LDFLAGS = -ObjC 7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-EFCalendarGraph 8 | PODS_ROOT = ${SRCROOT} 9 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /EFCalendarGraph.xcodeproj/xcuserdata/eliot.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | EFCalendarGraph.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 73B7D31A1B4B71570081BDF1 16 | 17 | primary 18 | 19 | 20 | 73B7D3331B4B71570081BDF1 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /EFCalendarGraphTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.eliotfowler.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/eliot.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-EFCalendarGraph-PureLayout.xcscheme 8 | 9 | isShown 10 | 11 | 12 | Pods-EFCalendarGraph.xcscheme 13 | 14 | isShown 15 | 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 65BF16635D5C94257C9A3499 21 | 22 | primary 23 | 24 | 25 | CD04A0BF085DADCF4A945CA6 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph-PureLayout/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.0.6 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | *.xcbkptlist 26 | 27 | ## Obj-C/Swift specific 28 | *.hmap 29 | *.ipa 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | #Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | -------------------------------------------------------------------------------- /EFCalendarGraphTests/EFCalendarGraphTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // EFCalendarGraphTests.m 3 | // EFCalendarGraphTests 4 | // 5 | // Created by Eliot Fowler on 7/6/15. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface EFCalendarGraphTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation EFCalendarGraphTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Pods/PureLayout/LICENSE: -------------------------------------------------------------------------------- 1 | This code is distributed under the terms and conditions of the MIT license. 2 | 3 | Copyright (c) 2014-2015 Tyler Fox 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## PureLayout 5 | 6 | This code is distributed under the terms and conditions of the MIT license. 7 | 8 | Copyright (c) 2014-2015 Tyler Fox 9 | 10 | 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: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | 14 | 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. 15 | 16 | Generated by CocoaPods - http://cocoapods.org 17 | -------------------------------------------------------------------------------- /EFCalendarGraph/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /EFCalendarGraph/EFCalendarGraph.h: -------------------------------------------------------------------------------- 1 | // 2 | // EFCalendarGraph.h 3 | // EFCalendarGraph 4 | // 5 | // Created by Eliot Fowler on 7/6/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSUInteger, EFCalendarGraphSquareModifier) { 12 | EFCalendarGraphSquareModifierAlpha = 0 13 | }; 14 | 15 | @protocol EFCalendarGraphDataSource; 16 | 17 | IB_DESIGNABLE 18 | @interface EFCalendarGraph : UIView 19 | 20 | @property (nonatomic, weak) id dataSource; 21 | @property (nonatomic, assign) EFCalendarGraphSquareModifier squareModifier; 22 | @property (nonatomic, strong) NSArray *modifierDenominations; 23 | @property (nonatomic, strong) UIColor *baseColor; 24 | @property (nonatomic, strong) UIColor *zeroColor; 25 | @property (nonatomic, assign) BOOL automaticallyAdjustsFrameToContent; 26 | @property (nonatomic, assign, readonly) CGSize contentSize; 27 | 28 | - (instancetype)initWithStartDate:(NSDate *)startDate; 29 | - (instancetype)initWithEndDate:(NSDate *)endDate; 30 | 31 | - (void)reloadData; 32 | 33 | @end 34 | 35 | /** 36 | * The `EFCalendarGraphDataSource` protocol defines required methods 37 | * that the graph uses to draw itself. 38 | */ 39 | @protocol EFCalendarGraphDataSource 40 | 41 | - (NSUInteger)numberOfDataPointsInCalendarGraph:(EFCalendarGraph *)calendarGraph; 42 | 43 | - (id)calendarGraph:(EFCalendarGraph *)calendarGraph 44 | valueForDate:(NSDate *)date 45 | daysAfterStartDate:(NSUInteger)daysAfterStartDate 46 | daysBeforeEndDate:(NSUInteger)daysBeforeEndDate; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/PureLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // PureLayout.h 3 | // v2.0.5 4 | // https://github.com/smileyborg/PureLayout 5 | // 6 | // Copyright (c) 2014-2015 Tyler Fox 7 | // 8 | // This code is distributed under the terms and conditions of the MIT license. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to 12 | // deal in the Software without restriction, including without limitation the 13 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | // sell copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | // IN THE SOFTWARE. 27 | // 28 | 29 | #ifndef PureLayout_h 30 | #define PureLayout_h 31 | 32 | #import "ALView+PureLayout.h" 33 | #import "NSArray+PureLayout.h" 34 | #import "NSLayoutConstraint+PureLayout.h" 35 | 36 | #endif /* PureLayout_h */ 37 | -------------------------------------------------------------------------------- /EFCalendarGraph/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /EFCalendarGraph/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // EFCalendarGraph 4 | // 5 | // Created by Eliot Fowler on 7/6/15. 6 | // 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "EFCalendarGraph.h" 11 | #import "NSDate+Utilities.h" 12 | 13 | @interface ViewController () 14 | 15 | @property (nonatomic, strong) EFCalendarGraph *calendarGraph; 16 | @property (nonatomic, strong) NSArray *values; 17 | 18 | @end 19 | 20 | @implementation ViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | // Fake Data 26 | NSMutableArray *values = [NSMutableArray array]; 27 | for (int i = 0; i < 365; i++) 28 | { 29 | [values addObject:arc4random() % 2 == 0 ? @0 : @(arc4random() % 5)]; 30 | } 31 | self.values = values; 32 | 33 | NSDate *endDate = [NSDate new]; 34 | 35 | self.calendarGraph = [[EFCalendarGraph alloc] initWithEndDate:endDate]; 36 | self.calendarGraph.dataSource = self; 37 | [self.view addSubview:self.calendarGraph]; 38 | self.calendarGraph.frame = CGRectMake(20, CGRectGetHeight(self.view.bounds)/2 - 60, CGRectGetWidth(self.view.bounds) - 40, 120); 39 | 40 | [self.calendarGraph reloadData]; 41 | } 42 | 43 | #pragma mark - EFCalendarGraph Data Source 44 | 45 | - (NSUInteger)numberOfDataPointsInCalendarGraph:(EFCalendarGraph *)calendarGraph 46 | { 47 | return self.values.count; 48 | } 49 | 50 | -(id)calendarGraph:(EFCalendarGraph *)calendarGraph 51 | valueForDate:(NSDate *)date 52 | daysAfterStartDate:(NSUInteger)daysAfterStartDate 53 | daysBeforeEndDate:(NSUInteger)daysBeforeEndDate 54 | { 55 | return self.values[daysAfterStartDate]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /EFCalendarGraph/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.eliotfowler.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /EFCalendarGraph/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // EFCalendarGraph 4 | // 5 | // Created by Eliot Fowler on 7/6/15. 6 | // 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/NSLayoutConstraint+PureLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+PureLayout.h 3 | // v2.0.5 4 | // https://github.com/smileyborg/PureLayout 5 | // 6 | // Copyright (c) 2013-2015 Tyler Fox 7 | // 8 | // This code is distributed under the terms and conditions of the MIT license. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to 12 | // deal in the Software without restriction, including without limitation the 13 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | // sell copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | // IN THE SOFTWARE. 27 | // 28 | 29 | #import "PureLayoutDefines.h" 30 | 31 | 32 | #pragma mark - NSLayoutConstraint+PureLayout 33 | 34 | /** 35 | A category on NSLayoutConstraint that allows constraints to be easily installed & removed. 36 | */ 37 | @interface NSLayoutConstraint (PureLayout) 38 | 39 | 40 | #pragma mark Install & Remove Constraints 41 | 42 | /** Activates the the constraint. */ 43 | - (void)autoInstall; 44 | 45 | /** Deactivates the constraint. */ 46 | - (void)autoRemove; 47 | 48 | 49 | #pragma mark Identify Constraints 50 | 51 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 52 | 53 | /** Sets the string as the identifier for this constraint. Available in iOS 7.0 and OS X 10.9 and later. */ 54 | - (instancetype)autoIdentify:(NSString *)identifier; 55 | 56 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | This code is distributed under the terms and conditions of the MIT license. 18 | 19 | Copyright (c) 2014-2015 Tyler Fox 20 | 21 | 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: 22 | 23 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 24 | 25 | 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. 26 | 27 | Title 28 | PureLayout 29 | Type 30 | PSGroupSpecifier 31 | 32 | 33 | FooterText 34 | Generated by CocoaPods - http://cocoapods.org 35 | Title 36 | 37 | Type 38 | PSGroupSpecifier 39 | 40 | 41 | StringsTable 42 | Acknowledgements 43 | Title 44 | Acknowledgements 45 | 46 | 47 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/eliot.xcuserdatad/xcschemes/Pods-EFCalendarGraph.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/eliot.xcuserdatad/xcschemes/Pods-EFCalendarGraph-PureLayout.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | local source="${BUILT_PRODUCTS_DIR}/Pods-EFCalendarGraph/$1" 12 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 13 | 14 | if [ -L "${source}" ]; then 15 | echo "Symlinked..." 16 | source=$(readlink "${source}") 17 | fi 18 | 19 | # use filter instead of exclude so missing patterns dont' throw errors 20 | echo "rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers/" --filter "- PrivateHeaders/" --filter "- Modules/" ${source} ${destination}" 21 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers/" --filter "- PrivateHeaders/" --filter "- Modules/" "${source}" "${destination}" 22 | # Resign the code if required by the build settings to avoid unstable apps 23 | if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then 24 | code_sign "${destination}/$1" 25 | fi 26 | 27 | # Embed linked Swift runtime libraries 28 | local basename 29 | basename=$(echo $1 | sed -E s/\\..+// && exit ${PIPESTATUS[0]}) 30 | local swift_runtime_libs 31 | swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/$1/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 32 | for lib in $swift_runtime_libs; do 33 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 34 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 35 | if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then 36 | code_sign "${destination}/${lib}" 37 | fi 38 | done 39 | } 40 | 41 | # Signs a framework with the provided identity 42 | code_sign() { 43 | # Use the current code_sign_identitiy 44 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 45 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements $1" 46 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" 47 | } 48 | 49 | 50 | if [[ "$CONFIGURATION" == "Debug" ]]; then 51 | install_framework 'PureLayout.framework' 52 | fi 53 | if [[ "$CONFIGURATION" == "Release" ]]; then 54 | install_framework 'PureLayout.framework' 55 | fi 56 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/PureLayout+Internal.h: -------------------------------------------------------------------------------- 1 | // 2 | // PureLayout+Internal.h 3 | // v2.0.5 4 | // https://github.com/smileyborg/PureLayout 5 | // 6 | // Copyright (c) 2014-2015 Tyler Fox 7 | // 8 | // This code is distributed under the terms and conditions of the MIT license. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to 12 | // deal in the Software without restriction, including without limitation the 13 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | // sell copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | // IN THE SOFTWARE. 27 | // 28 | 29 | #import "PureLayoutDefines.h" 30 | 31 | /** A constant that represents the smallest valid positive value for the multiplier of a constraint, 32 | since a value of 0 will cause the second item to be lost in the internal auto layout engine. */ 33 | static const CGFloat kMULTIPLIER_MIN_VALUE = 0.00001; // very small floating point numbers (e.g. CGFLOAT_MIN) can cause problems 34 | 35 | 36 | /** 37 | A category that exposes the internal (private) helper methods of the ALView+PureLayout category. 38 | */ 39 | @interface ALView (PureLayoutInternal) 40 | 41 | + (BOOL)al_preventAutomaticConstraintInstallation; 42 | + (NSMutableArray *)al_currentArrayOfCreatedConstraints; 43 | + (BOOL)al_isExecutingPriorityConstraintsBlock; 44 | + (ALLayoutPriority)al_currentGlobalConstraintPriority; 45 | + (NSString *)al_currentGlobalConstraintIdentifier; 46 | + (void)al_applyGlobalStateToConstraint:(NSLayoutConstraint *)constraint; 47 | - (void)al_addConstraint:(NSLayoutConstraint *)constraint; 48 | - (ALView *)al_commonSuperviewWithView:(ALView *)otherView; 49 | - (NSLayoutConstraint *)al_alignAttribute:(ALAttribute)attribute toView:(ALView *)otherView forAxis:(ALAxis)axis; 50 | 51 | @end 52 | 53 | 54 | /** 55 | A category that exposes the internal (private) helper methods of the NSArray+PureLayout category. 56 | */ 57 | @interface NSArray (PureLayoutInternal) 58 | 59 | - (ALView *)al_commonSuperviewOfViews; 60 | - (BOOL)al_containsMinimumNumberOfViews:(NSUInteger)minimumNumberOfViews; 61 | - (NSArray *)al_copyViewsOnly; 62 | 63 | @end 64 | 65 | 66 | /** 67 | A category that exposes the internal (private) helper methods of the NSLayoutConstraint+PureLayout category. 68 | */ 69 | @interface NSLayoutConstraint (PureLayoutInternal) 70 | 71 | + (NSLayoutAttribute)al_layoutAttributeForAttribute:(ALAttribute)attribute; 72 | + (ALLayoutConstraintAxis)al_constraintAxisForAxis:(ALAxis)axis; 73 | #if __PureLayout_MinBaseSDK_iOS_8_0 74 | + (ALMargin)al_marginForEdge:(ALEdge)edge; 75 | + (ALMarginAxis)al_marginAxisForAxis:(ALAxis)axis; 76 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /EFCalendarGraph/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /EFCalendarGraph/NSDate+Utilities.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+Utilties.h 3 | // Crossword 4 | // 5 | // Created by Erica Sadun 6 | // 7 | 8 | #import 9 | 10 | #define D_MINUTE 60 11 | #define D_HOUR 3600 12 | #define D_DAY 86400 13 | #define D_WEEK 604800 14 | #define D_YEAR 31556926 15 | 16 | 17 | @interface NSDate (Utilties) 18 | 19 | + (NSCalendar *)currentCalendar; // avoid bottlenecks 20 | 21 | // Relative dates from the current date 22 | + (NSDate *)dateTomorrow; 23 | + (NSDate *)dateYesterday; 24 | + (NSDate *)dateWithDaysFromNow:(NSInteger)days; 25 | + (NSDate *)dateWithDaysBeforeNow:(NSInteger)days; 26 | + (NSDate *)dateWithHoursFromNow:(NSInteger)dHours; 27 | + (NSDate *)dateWithHoursBeforeNow:(NSInteger)dHours; 28 | + (NSDate *)dateWithMinutesFromNow:(NSInteger)dMinutes; 29 | + (NSDate *)dateWithMinutesBeforeNow:(NSInteger)dMinutes; 30 | 31 | // Short string utilities 32 | - (NSString *)stringWithDateStyle:(NSDateFormatterStyle)dateStyle timeStyle:(NSDateFormatterStyle)timeStyle; 33 | - (NSString *)stringWithFormat:(NSString *)format; 34 | @property (nonatomic, readonly) NSString *shortString; 35 | @property (nonatomic, readonly) NSString *shortDateString; 36 | @property (nonatomic, readonly) NSString *shortTimeString; 37 | @property (nonatomic, readonly) NSString *mediumString; 38 | @property (nonatomic, readonly) NSString *mediumDateString; 39 | @property (nonatomic, readonly) NSString *mediumTimeString; 40 | @property (nonatomic, readonly) NSString *longString; 41 | @property (nonatomic, readonly) NSString *longDateString; 42 | @property (nonatomic, readonly) NSString *longTimeString; 43 | 44 | // Comparing dates 45 | - (BOOL)isEqualToDateIgnoringTime:(NSDate *)aDate; 46 | 47 | - (BOOL)isToday; 48 | - (BOOL)isTomorrow; 49 | - (BOOL)isYesterday; 50 | 51 | - (BOOL)isSameWeekAsDate:(NSDate *)aDate; 52 | - (BOOL)isThisWeek; 53 | - (BOOL)isNextWeek; 54 | - (BOOL)isLastWeek; 55 | 56 | - (BOOL)isSameMonthAsDate:(NSDate *)aDate; 57 | - (BOOL)isThisMonth; 58 | - (BOOL)isNextMonth; 59 | - (BOOL)isLastMonth; 60 | 61 | - (BOOL)isSameYearAsDate:(NSDate *)aDate; 62 | - (BOOL)isThisYear; 63 | - (BOOL)isNextYear; 64 | - (BOOL)isLastYear; 65 | 66 | - (BOOL)isEarlierThanDate:(NSDate *)aDate; 67 | - (BOOL)isLaterThanDate:(NSDate *)aDate; 68 | 69 | - (BOOL)isInFuture; 70 | - (BOOL)isInPast; 71 | 72 | // Date roles 73 | - (BOOL)isTypicallyWorkday; 74 | - (BOOL)isTypicallyWeekend; 75 | 76 | // Adjusting dates 77 | - (NSDate *)dateByAddingYears:(NSInteger)dYears; 78 | - (NSDate *)dateBySubtractingYears:(NSInteger)dYears; 79 | - (NSDate *)dateByAddingMonths:(NSInteger)dMonths; 80 | - (NSDate *)dateBySubtractingMonths:(NSInteger)dMonths; 81 | - (NSDate *)dateByAddingDays:(NSInteger)dDays; 82 | - (NSDate *)dateBySubtractingDays:(NSInteger)dDays; 83 | - (NSDate *)dateByAddingHours:(NSInteger)dHours; 84 | - (NSDate *)dateBySubtractingHours:(NSInteger)dHours; 85 | - (NSDate *)dateByAddingMinutes:(NSInteger)dMinutes; 86 | - (NSDate *)dateBySubtractingMinutes:(NSInteger)dMinutes; 87 | 88 | // Date extremes 89 | - (NSDate *)dateAtStartOfDay; 90 | - (NSDate *)dateAtEndOfDay; 91 | 92 | // Retrieving intervals 93 | - (NSInteger)minutesAfterDate:(NSDate *)aDate; 94 | - (NSInteger)minutesBeforeDate:(NSDate *)aDate; 95 | - (NSInteger)hoursAfterDate:(NSDate *)aDate; 96 | - (NSInteger)hoursBeforeDate:(NSDate *)aDate; 97 | - (NSInteger)daysAfterDate:(NSDate *)aDate; 98 | - (NSInteger)daysBeforeDate:(NSDate *)aDate; 99 | - (NSInteger)distanceInDaysToDate:(NSDate *)anotherDate; 100 | 101 | // Decomposing dates 102 | @property (readonly) NSInteger nearestHour; 103 | @property (readonly) NSInteger hour; 104 | @property (readonly) NSInteger minute; 105 | @property (readonly) NSInteger seconds; 106 | @property (readonly) NSInteger day; 107 | @property (readonly) NSInteger month; 108 | @property (readonly) NSInteger week; 109 | @property (readonly) NSInteger weekday; 110 | @property (readonly) NSInteger nthWeekday; // e.g. 2nd Tuesday of the month == 2 111 | @property (readonly) NSInteger year; 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY=$(cd "${1%/*}" && pwd) 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | if [[ "${ACTION}" == "install" ]]; then 63 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 64 | fi 65 | rm -f "$RESOURCES_TO_COPY" 66 | 67 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 68 | then 69 | case "${TARGETED_DEVICE_FAMILY}" in 70 | 1,2) 71 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 72 | ;; 73 | 1) 74 | TARGET_DEVICE_ARGS="--target-device iphone" 75 | ;; 76 | 2) 77 | TARGET_DEVICE_ARGS="--target-device ipad" 78 | ;; 79 | *) 80 | TARGET_DEVICE_ARGS="--target-device mac" 81 | ;; 82 | esac 83 | 84 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 85 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 86 | while read line; do 87 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 88 | XCASSET_FILES+=("$line") 89 | fi 90 | done <<<"$OTHER_XCASSETS" 91 | 92 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 93 | fi 94 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | EFCalendarGraph 2 | =============== 3 | 4 | Demo 5 | ---- 6 | 7 | This code: 8 | 9 | ~~~objectivec 10 | - (void)viewDidLoad 11 | { 12 | EFCalendarGraph *calendarGraph = [[EFCalendarGraph alloc] initWithEndDate:[NSDate new]]; 13 | self.calendarGraph.dataSource = self; 14 | [self.view addSubview:calendarGraph]; 15 | self.calendarGraph.frame = CGRectMake(20, CGRectGetHeight(self.view.bounds)/2 - 60, CGRectGetWidth(self.view.bounds) - 40, 120); 16 | 17 | [self.calendarGraph reloadData]; 18 | } 19 | 20 | - (NSUInteger)numberOfDataPointsInCalendarGraph:(EFCalendarGraph *)calendarGraph 21 | { 22 | return 14; 23 | } 24 | 25 | -(id)calendarGraph:(EFCalendarGraph *)calendarGraph 26 | valueForDate:(NSDate *)date 27 | daysAfterStartDate:(NSUInteger)daysAfterStartDate 28 | daysBeforeEndDate:(NSUInteger)daysBeforeEndDate 29 | { 30 | return arc4random() % 2 == 0 ? @0 : @(arc4random() % 5; 31 | } 32 | 33 | ~~~ 34 | 35 | will produce this: 36 | 37 | ![14 Days Calendar Graph](https://github.com/eliotfowler/EFCalendarGraph/blob/master/Images/14Days.png) 38 | 39 | or with 365 days: 40 | 41 | ![365 Days Calendar Graph](https://github.com/eliotfowler/EFCalendarGraph/blob/master/Images/365Days.png) 42 | 43 | Also, note that I am uploading this on a Monday. Since we are setting this up with an end date `initWithEndDate...`, you'll see the last box is the second from the top. The days start with Sunday at the top and each day follows normally. This will be configurable in the future. 44 | 45 | Installation 46 | ------------ 47 | 48 | Until the first CocoaPods release, clone the project and copy the EFCalendarGraph/NSDate+Utilities.{h,m} files into your project. 49 | 50 | Important Methods 51 | ----------------- 52 | 53 | It's important to note that after changing any of the options or your data, you should call `[calendarGraph reloadData]`. 54 | 55 | DataSource 56 | ---------- 57 | 58 | The EFCalendarGraphDataSource protocol defines 2 required methods that allow it to present your data: 59 | 60 | `- (NSUInteger)numberOfDataPointsInCalendarGraph:(EFCalendarGraph *)calendarGraph` 61 | 62 | This is very self explanatory, just return the number of squares that you want to show. This is important because it is how the view decides how big the boxes can be and still fit inside its bounds. 63 | 64 | ``` 65 | - (id)calendarGraph:(EFCalendarGraph *)calendarGraph 66 | valueForDate:(NSDate *)date 67 | daysAfterStartDate:(NSUInteger)daysAfterStartDate 68 | daysBeforeEndDate:(NSUInteger)daysBeforeEndDate; 69 | ``` 70 | 71 | This is the method where you will return the data points for each square when requested. **The return type says `id`, but is currently only accepting `NSNumber`.** In the future, I would like to support accepting any `id` and optinally delegating to the user to determine the denomination. 72 | 73 | Options 74 | ------- 75 | 76 | ###Properties (default) 77 | 78 | ####EFCalendarGraphSquareModifier squareModifier (EFCalendarGraphSquareModifierAlpha) 79 | 80 | Currently the only value, setting this to EFCalendarGraphSquareModifierAlpha will cause variance in value to change the alpha of each of the boxes. 81 | 82 | ####NSArray *modifierDenominations (@[@.3, @.4, @.5, @.6, @.7, @.9]) 83 | 84 | Seemingly random, but this set of numbers seems to work fairly well for most data sets that I've encountered so far. You can set this array to any set of numbers between 0 and 1. It does not have to be 6 numbers either, you can have as many or as few as you want. 85 | 86 | ####UIColor *baseColor ([UIColor greenColor]) 87 | 88 | This is the color that will fill the squares. 89 | 90 | ####UIColor *zeroColor ([UIColor colorWithRed:.9 green:.9 blue:.9 alpha:.5]) 91 | 92 | This is the color that the boxes will be when the value for the box is 0. 93 | 94 | License (MIT) 95 | ------------- 96 | 97 | Copyright (c) 2015 Eliot Fowler 98 | 99 | 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: 100 | 101 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 102 | 103 | 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. -------------------------------------------------------------------------------- /EFCalendarGraph.xcodeproj/xcuserdata/eliot.xcuserdatad/xcschemes/EFCalendarGraph.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/NSArray+PureLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+PureLayout.h 3 | // v2.0.5 4 | // https://github.com/smileyborg/PureLayout 5 | // 6 | // Copyright (c) 2012 Richard Turton 7 | // Copyright (c) 2013-2015 Tyler Fox 8 | // 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy 12 | // of this software and associated documentation files (the "Software"), to 13 | // deal in the Software without restriction, including without limitation the 14 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 15 | // sell copies of the Software, and to permit persons to whom the Software is 16 | // furnished to do so, subject to the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be included in 19 | // all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 27 | // IN THE SOFTWARE. 28 | // 29 | 30 | #import "PureLayoutDefines.h" 31 | 32 | 33 | #pragma mark - NSArray+PureLayout 34 | 35 | /** 36 | A category on NSArray that provides a simple yet powerful interface to: 37 | - Manage an array of Auto Layout constraints 38 | - Apply constraints to an array of views 39 | */ 40 | @interface NSArray (PureLayout) 41 | 42 | 43 | #pragma mark Array of Constraints 44 | 45 | /** Activates the constraints in this array. */ 46 | - (void)autoInstallConstraints; 47 | 48 | /** Deactivates the constraints in this array. */ 49 | - (void)autoRemoveConstraints; 50 | 51 | #if __PureLayout_MinBaseSDK_iOS_8_0 52 | 53 | /** Sets the string as the identifier for the constraints in this array. Available in iOS 7.0 and OS X 10.9 and later. */ 54 | - (instancetype)autoIdentifyConstraints:(NSString *)identifier; 55 | 56 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 57 | 58 | 59 | #pragma mark Array of Views 60 | 61 | /** Aligns views in this array to one another along a given edge. */ 62 | - (NSArray *)autoAlignViewsToEdge:(ALEdge)edge; 63 | 64 | /** Aligns views in this array to one another along a given axis. */ 65 | - (NSArray *)autoAlignViewsToAxis:(ALAxis)axis; 66 | 67 | /** Matches a given dimension of all the views in this array. */ 68 | - (NSArray *)autoMatchViewsDimension:(ALDimension)dimension; 69 | 70 | /** Sets the given dimension of all the views in this array to a given size. */ 71 | - (NSArray *)autoSetViewsDimension:(ALDimension)dimension toSize:(CGFloat)size; 72 | 73 | /** Sets all of the views in this array to a given size. */ 74 | - (NSArray *)autoSetViewsDimensionsToSize:(CGSize)size; 75 | 76 | 77 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them. */ 78 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis 79 | alignedTo:(ALAttribute)alignment 80 | withFixedSpacing:(CGFloat)spacing; 81 | 82 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them, with optional insets from the first and last views to their superview. */ 83 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis 84 | alignedTo:(ALAttribute)alignment 85 | withFixedSpacing:(CGFloat)spacing 86 | insetSpacing:(BOOL)shouldSpaceInsets; 87 | 88 | /** Distributes the views in this array equally along the selected axis in their superview. Views will have spacing (fixed) between them, with optional insets from the first and last views to their superview, and optionally constrained to the same size in the dimension along the axis. */ 89 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis 90 | alignedTo:(ALAttribute)alignment 91 | withFixedSpacing:(CGFloat)spacing 92 | insetSpacing:(BOOL)shouldSpaceInsets 93 | matchedSizes:(BOOL)shouldMatchSizes; 94 | 95 | 96 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them. */ 97 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis 98 | alignedTo:(ALAttribute)alignment 99 | withFixedSize:(CGFloat)size; 100 | 101 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them, with optional insets from the first and last views to their superview. */ 102 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis 103 | alignedTo:(ALAttribute)alignment 104 | withFixedSize:(CGFloat)size 105 | insetSpacing:(BOOL)shouldSpaceInsets; 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /Pods/PureLayout/README.md: -------------------------------------------------------------------------------- 1 | # [![PureLayout](https://github.com/smileyborg/PureLayout/blob/master/Images/PureLayout.png?raw=true)](#) 2 | [![Build Status](http://img.shields.io/travis/smileyborg/PureLayout.svg?style=flat)](https://travis-ci.org/smileyborg/PureLayout) [![Test Coverage](http://img.shields.io/coveralls/smileyborg/PureLayout.svg?style=flat)](https://coveralls.io/r/smileyborg/PureLayout) [![Version](http://img.shields.io/cocoapods/v/PureLayout.svg?style=flat)](http://cocoapods.org/?q=PureLayout) [![Platform](http://img.shields.io/cocoapods/p/PureLayout.svg?style=flat)](http://cocoapods.org/?q=PureLayout) [![License](http://img.shields.io/cocoapods/l/PureLayout.svg?style=flat)](LICENSE) 3 | 4 | The ultimate API for iOS & OS X Auto Layout — impressively simple, immensely powerful. PureLayout extends `UIView`/`NSView`, `NSArray`, and `NSLayoutConstraint` with a comprehensive Auto Layout API that is modeled after Apple's own frameworks. PureLayout is an Objective-C library that also works (and looks!) great with Swift using a bridging header. 5 | 6 | Writing Auto Layout code from scratch isn't easy. PureLayout provides a fully capable and developer-friendly interface for Auto Layout. It is designed for clarity and simplicity, and takes inspiration from the AutoLayout UI options available in Interface Builder while delivering far more flexibility. The API is also highly efficient, as it adds only a thin layer of third party code and is engineered for maximum performance. 7 | 8 | ## API Cheat Sheet 9 | This is just a handy overview of the core API methods. Explore the [header files](PureLayout/PureLayout) for the full API, and find the complete documentation above the implementation of each method in the corresponding .m file. A couple of notes: 10 | 11 | * All of the public API methods are namespaced with the prefix `auto...`, which also makes it easy for Xcode to autocomplete as you type. 12 | * Methods that create constraints also automatically install (activate) the constraint(s), then return the new constraint(s) for you to optionally store for later adjustment or removal. 13 | * Many methods below also have a variant which includes a `relation:` parameter to make the constraint an inequality. 14 | 15 | ### Attributes 16 | 17 | PureLayout defines view attributes that are used to create auto layout constraints. Here is an [illustration of the most common attributes](Images/PureLayout-CommonAttributes.png). 18 | 19 | There are 5 specific attribute types, which are used throughout most of the API: 20 | 21 | * `ALEdge` 22 | * `ALDimension` 23 | * `ALAxis` 24 | * `ALMargin` *available in iOS 8.0 and higher only* 25 | * `ALMarginAxis` *available in iOS 8.0 and higher only* 26 | 27 | Additionally, there is one generic attribute type, `ALAttribute`, which is effectively a union of all the specific types. You can think of this as the "supertype" of all of the specific attribute types, which means that it is always safe to cast a specific type to the generic `ALAttribute` type. (Note that the reverse is not true -- casting a generic ALAttribute to a specific attribute type is unsafe!) 28 | 29 | ### [`UIView`/`NSView`](PureLayout/PureLayout/ALView%2BPureLayout.h) 30 | 31 | + autoCreateConstraintsWithoutInstalling: 32 | + autoSetPriority:forConstraints: 33 | + autoSetIdentifier:forConstraints: // iOS 7.0+, OS X 10.9+ only 34 | - autoSetContent(CompressionResistance|Hugging)PriorityForAxis: 35 | - autoCenterInSuperview: 36 | - autoAlignAxisToSuperviewAxis: 37 | - autoCenterInSuperviewMargins: // iOS 8.0+ only 38 | - autoAlignAxisToSuperviewMarginAxis: // iOS 8.0+ only 39 | - autoPinEdgeToSuperviewEdge:(withInset:) 40 | - autoPinEdgesToSuperviewEdgesWithInsets:(excludingEdge:) 41 | - autoPinEdgeToSuperviewMargin: // iOS 8.0+ only 42 | - autoPinEdgesToSuperviewMargins(ExcludingEdge:) // iOS 8.0+ only 43 | - autoPinEdge:toEdge:ofView:(withOffset:) 44 | - autoAlignAxis:toSameAxisOfView:(withOffset:) 45 | - autoMatchDimension:toDimension:ofView:(withOffset:|withMultiplier:) 46 | - autoSetDimension(s)ToSize: 47 | - autoConstrainAttribute:toAttribute:ofView:(withOffset:|withMultiplier:) 48 | - autoPinTo(Top|Bottom)LayoutGuideOfViewController:withInset: // iOS only 49 | 50 | ### [`NSArray`](PureLayout/PureLayout/NSArray%2BPureLayout.h) 51 | 52 | // Arrays of Constraints 53 | - autoInstallConstraints 54 | - autoRemoveConstraints 55 | - autoIdentifyConstraints: // iOS 7.0+, OS X 10.9+ only 56 | 57 | // Arrays of Views 58 | - autoAlignViewsToEdge: 59 | - autoAlignViewsToAxis: 60 | - autoMatchViewsDimension: 61 | - autoSetViewsDimension:toSize: 62 | - autoSetViewsDimensionsToSize: 63 | - autoDistributeViewsAlongAxis:alignedTo:withFixedSpacing:(insetSpacing:)(matchedSizes:) 64 | - autoDistributeViewsAlongAxis:alignedTo:withFixedSize:(insetSpacing:) 65 | 66 | ### [`NSLayoutConstraint`](PureLayout/PureLayout/NSLayoutConstraint%2BPureLayout.h) 67 | 68 | - autoInstall 69 | - autoRemove 70 | - autoIdentify: // iOS 7.0+, OS X 10.9+ only 71 | 72 | ## Setup 73 | *Note: PureLayout requires a minimum deployment target of iOS 6.0 or OS X 10.7* 74 | 75 | ### Using [CocoaPods](http://cocoapods.org) 76 | 1. Add the pod `PureLayout` to your [Podfile](http://guides.cocoapods.org/using/the-podfile.html). 77 | 78 | pod 'PureLayout' 79 | 80 | 2. Run `pod install` from Terminal, then open your app's `.xcworkspace` file to launch Xcode. 81 | 3. Import the `PureLayout.h` header. Typically, this should be written as `#import ` 82 | 83 | That's it - now go write some beautiful Auto Layout code! 84 | 85 | ### Using [Carthage](https://github.com/Carthage/Carthage) 86 | 1. Add the `smileyborg/PureLayout` project to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile). 87 | 88 | github "smileyborg/PureLayout" 89 | 90 | 2. Run `carthage update`, then follow the [additional steps required](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) to add the iOS and/or Mac frameworks into your project. 91 | 3. Import the PureLayout framework/module (with the appropriate name for the platform you're using it on). 92 | * Using Modules: `@import PureLayout_iOS` or `@import PureLayout_Mac` 93 | * Without Modules: `#import ` or `#import ` 94 | 95 | That's it - now go write some beautiful Auto Layout code! 96 | 97 | ### Manually from GitHub 98 | 1. Download the source files in the [PureLayout subdirectory](PureLayout/PureLayout). 99 | 2. Add the source files to your Xcode project. 100 | 3. Import the `PureLayout.h` header. 101 | 102 | That's it - now go write some beautiful Auto Layout code! 103 | 104 | ### App Extensions 105 | To use PureLayout in an App Extension, you need to do a bit of extra configuration to prevent usage of unavailable APIs. [Click here](https://github.com/smileyborg/PureLayout/wiki/App-Extensions) for more info. 106 | 107 | ### Releases 108 | Releases are tagged in the git commit history using [semantic versioning](http://semver.org). Check out the [releases and release notes](https://github.com/smileyborg/PureLayout/releases) for each version. 109 | 110 | ## Usage 111 | ### Example Project 112 | Open the project included in the repository (requires Xcode 6 or higher). It contains [iOS](PureLayout/Example-iOS) (`Example-iOS` scheme) and [OS X](PureLayout/Example-Mac) (`Example-Mac` scheme) demos of the library being used in various scenarios. 113 | 114 | On iOS, you can use different device simulators and rotate the device to see the constraints in action (as well as toggle the taller in-call status bar in the iOS Simulator). 115 | 116 | On OS X, while running the app, press any key to cycle through the demos. You can resize the window to see the constraints in action. 117 | 118 | ### Tips and Tricks 119 | Check out some [Tips and Tricks](https://github.com/smileyborg/PureLayout/wiki/Tips-and-Tricks) to keep in mind when using the API. 120 | 121 | ## PureLayout vs. the rest 122 | An overview of the Auto Layout options available, ordered from the lowest- to highest-level of abstraction. 123 | 124 | * Apple [NSLayoutConstraint SDK API](https://developer.apple.com/library/ios/documentation/AppKit/Reference/NSLayoutConstraint_Class/index.html#//apple_ref/occ/clm/NSLayoutConstraint/constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:) 125 | * Pros: Raw power 126 | * Cons: Extremely verbose, tedious to write, difficult to read 127 | * Apple [Visual Format Language](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/VisualFormatLanguage/VisualFormatLanguage.html) 128 | * Pros: Concise, convenient 129 | * Cons: Doesn't support some use cases, incomplete compile-time checks, must learn syntax, hard to debug 130 | * Apple Interface Builder 131 | * Pros: Visual, simple 132 | * Cons: Difficult for complex layouts, cannot dynamically set constraints at runtime, encourages hardcoded magic numbers, not always WYSIWYG 133 | * **PureLayout** 134 | * Pros: Simple, efficient, minimal third party code, consistent with Cocoa API style, compatible with Objective-C and Swift codebases 135 | * Cons: Not the most concise expression of layout code 136 | * High-level Auto Layout Libraries/DSLs ([Cartography](https://github.com/robb/Cartography), [SnapKit](https://github.com/SnapKit/SnapKit), [KeepLayout](https://github.com/iMartinKiss/KeepLayout)) 137 | * Pros: Very clean, concise, and convenient 138 | * Cons: Unique API style is foreign to Cocoa APIs, mixed compatibility with Objective-C & Swift, greater dependency on third party code 139 | 140 | PureLayout takes a balanced approach to Auto Layout that makes it well suited for any project. 141 | 142 | ## Problems, Suggestions, Pull Requests? 143 | Please open a [new Issue here](https://github.com/smileyborg/PureLayout/issues/new) if you run into an issue, have a feature request, or want to share a comment. Note that general Auto Layout questions should be asked on [Stack Overflow](http://stackoverflow.com). 144 | 145 | If you're considering taking on significant changes or additions to the project, please communicate in advance by opening a new Issue. This allows everyone to get onboard with upcoming changes, ensures that changes align with the project's design philosophy, and avoids duplicated work. 146 | 147 | ## Meta 148 | Designed & maintained by Tyler Fox ([@smileyborg](https://twitter.com/smileyborg)). Distributed with the MIT license. 149 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/NSLayoutConstraint+PureLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+PureLayout.m 3 | // v2.0.5 4 | // https://github.com/smileyborg/PureLayout 5 | // 6 | // Copyright (c) 2013-2015 Tyler Fox 7 | // 8 | // This code is distributed under the terms and conditions of the MIT license. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to 12 | // deal in the Software without restriction, including without limitation the 13 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | // sell copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | // IN THE SOFTWARE. 27 | // 28 | 29 | #import "NSLayoutConstraint+PureLayout.h" 30 | #import "ALView+PureLayout.h" 31 | #import "PureLayout+Internal.h" 32 | 33 | 34 | #pragma mark - NSLayoutConstraint+PureLayout 35 | 36 | @implementation NSLayoutConstraint (PureLayout) 37 | 38 | 39 | #pragma mark Installing & Removing Constraints 40 | 41 | /** 42 | Activates the constraint. 43 | */ 44 | - (void)autoInstall 45 | { 46 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 47 | if ([self respondsToSelector:@selector(setActive:)]) { 48 | [ALView al_applyGlobalStateToConstraint:self]; 49 | if ([ALView al_preventAutomaticConstraintInstallation]) { 50 | [[ALView al_currentArrayOfCreatedConstraints] addObject:self]; 51 | } else { 52 | self.active = YES; 53 | } 54 | return; 55 | } 56 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 57 | 58 | NSAssert(self.firstItem || self.secondItem, @"Can't install a constraint with nil firstItem and secondItem."); 59 | if (self.firstItem) { 60 | if (self.secondItem) { 61 | NSAssert([self.firstItem isKindOfClass:[ALView class]] && [self.secondItem isKindOfClass:[ALView class]], @"Can only automatically install a constraint if both items are views."); 62 | ALView *commonSuperview = [self.firstItem al_commonSuperviewWithView:self.secondItem]; 63 | [commonSuperview al_addConstraint:self]; 64 | } else { 65 | NSAssert([self.firstItem isKindOfClass:[ALView class]], @"Can only automatically install a constraint if the item is a view."); 66 | [self.firstItem al_addConstraint:self]; 67 | } 68 | } else { 69 | NSAssert([self.secondItem isKindOfClass:[ALView class]], @"Can only automatically install a constraint if the item is a view."); 70 | [self.secondItem al_addConstraint:self]; 71 | } 72 | } 73 | 74 | /** 75 | Deactivates the constraint. 76 | */ 77 | - (void)autoRemove 78 | { 79 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 80 | if ([self respondsToSelector:@selector(setActive:)]) { 81 | self.active = NO; 82 | return; 83 | } 84 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 85 | 86 | if (self.secondItem) { 87 | ALView *commonSuperview = [self.firstItem al_commonSuperviewWithView:self.secondItem]; 88 | while (commonSuperview) { 89 | if ([commonSuperview.constraints containsObject:self]) { 90 | [commonSuperview removeConstraint:self]; 91 | return; 92 | } 93 | commonSuperview = commonSuperview.superview; 94 | } 95 | } 96 | else { 97 | [self.firstItem removeConstraint:self]; 98 | return; 99 | } 100 | NSAssert(nil, @"Failed to remove constraint: %@", self); 101 | } 102 | 103 | 104 | #pragma mark Identify Constraints 105 | 106 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 107 | 108 | /** 109 | Sets the string as the identifier for this constraint. Available in iOS 7.0 and OS X 10.9 and later. 110 | The identifier will be printed along with the constraint's description. 111 | This is helpful to document a constraint's purpose and aid in debugging. 112 | 113 | @param identifier A string used to identify this constraint. 114 | @return This constraint. 115 | */ 116 | - (instancetype)autoIdentify:(NSString *)identifier 117 | { 118 | if ([self respondsToSelector:@selector(setIdentifier:)]) { 119 | self.identifier = identifier; 120 | } 121 | return self; 122 | } 123 | 124 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 125 | 126 | 127 | #pragma mark Internal Methods 128 | 129 | /** 130 | Returns the corresponding NSLayoutAttribute for the given ALAttribute. 131 | 132 | @return The layout attribute for the given ALAttribute. 133 | */ 134 | + (NSLayoutAttribute)al_layoutAttributeForAttribute:(ALAttribute)attribute 135 | { 136 | NSLayoutAttribute layoutAttribute = NSLayoutAttributeNotAnAttribute; 137 | switch (attribute) { 138 | case ALEdgeLeft: 139 | layoutAttribute = NSLayoutAttributeLeft; 140 | break; 141 | case ALEdgeRight: 142 | layoutAttribute = NSLayoutAttributeRight; 143 | break; 144 | case ALEdgeTop: 145 | layoutAttribute = NSLayoutAttributeTop; 146 | break; 147 | case ALEdgeBottom: 148 | layoutAttribute = NSLayoutAttributeBottom; 149 | break; 150 | case ALEdgeLeading: 151 | layoutAttribute = NSLayoutAttributeLeading; 152 | break; 153 | case ALEdgeTrailing: 154 | layoutAttribute = NSLayoutAttributeTrailing; 155 | break; 156 | case ALDimensionWidth: 157 | layoutAttribute = NSLayoutAttributeWidth; 158 | break; 159 | case ALDimensionHeight: 160 | layoutAttribute = NSLayoutAttributeHeight; 161 | break; 162 | case ALAxisVertical: 163 | layoutAttribute = NSLayoutAttributeCenterX; 164 | break; 165 | case ALAxisHorizontal: 166 | layoutAttribute = NSLayoutAttributeCenterY; 167 | break; 168 | case ALAxisBaseline: // same value as ALAxisLastBaseline 169 | layoutAttribute = NSLayoutAttributeBaseline; 170 | break; 171 | #if __PureLayout_MinBaseSDK_iOS_8_0 172 | case ALAxisFirstBaseline: 173 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALAxisFirstBaseline is only supported on iOS 8.0 or higher."); 174 | layoutAttribute = NSLayoutAttributeFirstBaseline; 175 | break; 176 | case ALMarginLeft: 177 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeLeftMargin is only supported on iOS 8.0 or higher."); 178 | layoutAttribute = NSLayoutAttributeLeftMargin; 179 | break; 180 | case ALMarginRight: 181 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeRightMargin is only supported on iOS 8.0 or higher."); 182 | layoutAttribute = NSLayoutAttributeRightMargin; 183 | break; 184 | case ALMarginTop: 185 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeTopMargin is only supported on iOS 8.0 or higher."); 186 | layoutAttribute = NSLayoutAttributeTopMargin; 187 | break; 188 | case ALMarginBottom: 189 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeBottomMargin is only supported on iOS 8.0 or higher."); 190 | layoutAttribute = NSLayoutAttributeBottomMargin; 191 | break; 192 | case ALMarginLeading: 193 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeLeadingMargin is only supported on iOS 8.0 or higher."); 194 | layoutAttribute = NSLayoutAttributeLeadingMargin; 195 | break; 196 | case ALMarginTrailing: 197 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeTrailingMargin is only supported on iOS 8.0 or higher."); 198 | layoutAttribute = NSLayoutAttributeTrailingMargin; 199 | break; 200 | case ALMarginAxisVertical: 201 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALAxisVerticalMargin is only supported on iOS 8.0 or higher."); 202 | layoutAttribute = NSLayoutAttributeCenterXWithinMargins; 203 | break; 204 | case ALMarginAxisHorizontal: 205 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"ALAxisHorizontalMargin is only supported on iOS 8.0 or higher."); 206 | layoutAttribute = NSLayoutAttributeCenterYWithinMargins; 207 | break; 208 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 209 | default: 210 | NSAssert(nil, @"Not a valid ALAttribute."); 211 | break; 212 | } 213 | return layoutAttribute; 214 | } 215 | 216 | /** 217 | Returns the corresponding ALLayoutConstraintAxis for the given ALAxis. 218 | 219 | @return The constraint axis for the given axis. 220 | */ 221 | + (ALLayoutConstraintAxis)al_constraintAxisForAxis:(ALAxis)axis 222 | { 223 | ALLayoutConstraintAxis constraintAxis; 224 | switch (axis) { 225 | case ALAxisVertical: 226 | constraintAxis = ALLayoutConstraintAxisVertical; 227 | break; 228 | case ALAxisHorizontal: 229 | case ALAxisBaseline: // same value as ALAxisLastBaseline 230 | #if __PureLayout_MinBaseSDK_iOS_8_0 231 | case ALAxisFirstBaseline: 232 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 233 | constraintAxis = ALLayoutConstraintAxisHorizontal; 234 | break; 235 | default: 236 | NSAssert(nil, @"Not a valid ALAxis."); 237 | constraintAxis = ALLayoutConstraintAxisHorizontal; // default to a random value to satisfy the compiler 238 | break; 239 | } 240 | return constraintAxis; 241 | } 242 | 243 | #if __PureLayout_MinBaseSDK_iOS_8_0 244 | 245 | /** 246 | Returns the corresponding margin for the given edge. 247 | 248 | @param edge The edge to convert to the corresponding margin. 249 | @return The margin for the given edge. 250 | */ 251 | + (ALMargin)al_marginForEdge:(ALEdge)edge 252 | { 253 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"Margin attributes are only supported on iOS 8.0 or higher."); 254 | ALMargin margin; 255 | switch (edge) { 256 | case ALEdgeLeft: 257 | margin = ALMarginLeft; 258 | break; 259 | case ALEdgeRight: 260 | margin = ALMarginRight; 261 | break; 262 | case ALEdgeTop: 263 | margin = ALMarginTop; 264 | break; 265 | case ALEdgeBottom: 266 | margin = ALMarginBottom; 267 | break; 268 | case ALEdgeLeading: 269 | margin = ALMarginLeading; 270 | break; 271 | case ALEdgeTrailing: 272 | margin = ALMarginTrailing; 273 | break; 274 | default: 275 | NSAssert(nil, @"Not a valid ALEdge."); 276 | margin = ALMarginLeft; // default to a random value to satisfy the compiler 277 | break; 278 | } 279 | return margin; 280 | } 281 | 282 | /** 283 | Returns the corresponding margin axis for the given axis. 284 | 285 | @param axis The axis to convert to the corresponding margin axis. 286 | @return The margin axis for the given axis. 287 | */ 288 | + (ALMarginAxis)al_marginAxisForAxis:(ALAxis)axis 289 | { 290 | NSAssert(__PureLayout_MinSysVer_iOS_8_0, @"Margin attributes are only supported on iOS 8.0 or higher."); 291 | ALMarginAxis marginAxis; 292 | switch (axis) { 293 | case ALAxisVertical: 294 | marginAxis = ALMarginAxisVertical; 295 | break; 296 | case ALAxisHorizontal: 297 | marginAxis = ALMarginAxisHorizontal; 298 | break; 299 | case ALAxisBaseline: 300 | case ALAxisFirstBaseline: 301 | NSAssert(nil, @"The baseline axis attributes do not have corresponding margin axis attributes."); 302 | marginAxis = ALMarginAxisVertical; // default to a random value to satisfy the compiler 303 | break; 304 | default: 305 | NSAssert(nil, @"Not a valid ALAxis."); 306 | marginAxis = ALMarginAxisVertical; // default to a random value to satisfy the compiler 307 | break; 308 | } 309 | return marginAxis; 310 | } 311 | 312 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 313 | 314 | @end 315 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/PureLayoutDefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // PureLayoutDefines.h 3 | // v2.0.5 4 | // https://github.com/smileyborg/PureLayout 5 | // 6 | // Copyright (c) 2014-2015 Tyler Fox 7 | // 8 | // This code is distributed under the terms and conditions of the MIT license. 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to 12 | // deal in the Software without restriction, including without limitation the 13 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | // sell copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | // IN THE SOFTWARE. 27 | // 28 | 29 | #ifndef PureLayoutDefines_h 30 | #define PureLayoutDefines_h 31 | 32 | #import 33 | 34 | // Define some preprocessor macros to check for a minimum Base SDK. These are used to prevent compile-time errors in older versions of Xcode. 35 | #define __PureLayout_MinBaseSDK_iOS_8_0 (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1) 36 | #define __PureLayout_MinBaseSDK_OSX_10_10 (!TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_9) 37 | 38 | // Define some preprocessor macros to check for a minimum System Version. These are used to prevent runtime crashes on older versions of iOS/OS X. 39 | #define __PureLayout_MinSysVer_iOS_7_0 (TARGET_OS_IPHONE && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) 40 | #define __PureLayout_MinSysVer_iOS_8_0 (TARGET_OS_IPHONE && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1) 41 | #define __PureLayout_MinSysVer_OSX_10_9 (!TARGET_OS_IPHONE && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_8_4) 42 | 43 | // Define generic AL-prefixed macros for the types/constants/etc that have slight naming variations across iOS and OS X, which allows the same code to be platform-independent 44 | #if TARGET_OS_IPHONE 45 | # import 46 | # define ALView UIView 47 | # define ALEdgeInsets UIEdgeInsets 48 | # define ALEdgeInsetsZero UIEdgeInsetsZero 49 | # define ALEdgeInsetsMake UIEdgeInsetsMake 50 | # define ALLayoutConstraintAxis UILayoutConstraintAxis 51 | # define ALLayoutConstraintOrientation ALLayoutConstraintAxis 52 | # define ALLayoutConstraintAxisHorizontal UILayoutConstraintAxisHorizontal 53 | # define ALLayoutConstraintAxisVertical UILayoutConstraintAxisVertical 54 | # define ALLayoutConstraintOrientationHorizontal ALLayoutConstraintAxisHorizontal 55 | # define ALLayoutConstraintOrientationVertical ALLayoutConstraintAxisVertical 56 | # define ALLayoutPriority UILayoutPriority 57 | # define ALLayoutPriorityRequired UILayoutPriorityRequired 58 | # define ALLayoutPriorityDefaultHigh UILayoutPriorityDefaultHigh 59 | # define ALLayoutPriorityDefaultLow UILayoutPriorityDefaultLow 60 | # define ALLayoutPriorityFittingSizeLevel UILayoutPriorityFittingSizeLevel 61 | # define ALLayoutPriorityFittingSizeCompression ALLayoutPriorityFittingSizeLevel 62 | #else 63 | # import 64 | # define ALView NSView 65 | # define ALEdgeInsets NSEdgeInsets 66 | # define ALEdgeInsetsZero NSEdgeInsetsMake(0, 0, 0, 0) 67 | # define ALEdgeInsetsMake NSEdgeInsetsMake 68 | # define ALLayoutConstraintOrientation NSLayoutConstraintOrientation 69 | # define ALLayoutConstraintAxis ALLayoutConstraintOrientation 70 | # define ALLayoutConstraintOrientationHorizontal NSLayoutConstraintOrientationHorizontal 71 | # define ALLayoutConstraintOrientationVertical NSLayoutConstraintOrientationVertical 72 | # define ALLayoutConstraintAxisHorizontal ALLayoutConstraintOrientationHorizontal 73 | # define ALLayoutConstraintAxisVertical ALLayoutConstraintOrientationVertical 74 | # define ALLayoutPriority NSLayoutPriority 75 | # define ALLayoutPriorityRequired NSLayoutPriorityRequired 76 | # define ALLayoutPriorityDefaultHigh NSLayoutPriorityDefaultHigh 77 | # define ALLayoutPriorityDefaultLow NSLayoutPriorityDefaultLow 78 | # define ALLayoutPriorityFittingSizeCompression NSLayoutPriorityFittingSizeCompression 79 | # define ALLayoutPriorityFittingSizeLevel ALLayoutPriorityFittingSizeCompression 80 | #endif /* TARGET_OS_IPHONE */ 81 | 82 | 83 | #pragma mark PureLayout Attributes 84 | 85 | /** Constants that represent edges of a view. */ 86 | typedef NS_ENUM(NSInteger, ALEdge) { 87 | /** The left edge of the view. */ 88 | ALEdgeLeft = NSLayoutAttributeLeft, 89 | /** The right edge of the view. */ 90 | ALEdgeRight = NSLayoutAttributeRight, 91 | /** The top edge of the view. */ 92 | ALEdgeTop = NSLayoutAttributeTop, 93 | /** The bottom edge of the view. */ 94 | ALEdgeBottom = NSLayoutAttributeBottom, 95 | /** The leading edge of the view (left edge for left-to-right languages like English, right edge for right-to-left languages like Arabic). */ 96 | ALEdgeLeading = NSLayoutAttributeLeading, 97 | /** The trailing edge of the view (right edge for left-to-right languages like English, left edge for right-to-left languages like Arabic). */ 98 | ALEdgeTrailing = NSLayoutAttributeTrailing 99 | }; 100 | 101 | /** Constants that represent dimensions of a view. */ 102 | typedef NS_ENUM(NSInteger, ALDimension) { 103 | /** The width of the view. */ 104 | ALDimensionWidth = NSLayoutAttributeWidth, 105 | /** The height of the view. */ 106 | ALDimensionHeight = NSLayoutAttributeHeight 107 | }; 108 | 109 | /** Constants that represent axes of a view. */ 110 | typedef NS_ENUM(NSInteger, ALAxis) { 111 | /** A vertical line through the middle of the view's left and right edges. */ 112 | ALAxisVertical = NSLayoutAttributeCenterX, 113 | /** A horizontal line through the middle of the view's top and bottom edges. */ 114 | ALAxisHorizontal = NSLayoutAttributeCenterY, 115 | 116 | /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) Same as ALAxisLastBaseline. */ 117 | ALAxisBaseline = NSLayoutAttributeBaseline, 118 | /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) */ 119 | ALAxisLastBaseline = ALAxisBaseline, 120 | #if __PureLayout_MinBaseSDK_iOS_8_0 121 | /** A horizontal line at the baseline of the first line of text in a view. (For views that do not draw text, will be equivalent to ALEdgeTop.) Available in iOS 8.0 and later. */ 122 | ALAxisFirstBaseline = NSLayoutAttributeFirstBaseline 123 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 124 | }; 125 | 126 | #if __PureLayout_MinBaseSDK_iOS_8_0 127 | 128 | /** Constants that represent layout margins of a view. Available in iOS 8.0 and later. */ 129 | typedef NS_ENUM(NSInteger, ALMargin) { 130 | /** The left margin of the view, based on the view's layoutMargins left inset. */ 131 | ALMarginLeft = NSLayoutAttributeLeftMargin, 132 | /** The right margin of the view, based on the view's layoutMargins right inset. */ 133 | ALMarginRight = NSLayoutAttributeRightMargin, 134 | /** The top margin of the view, based on the view's layoutMargins top inset. */ 135 | ALMarginTop = NSLayoutAttributeTopMargin, 136 | /** The bottom margin of the view, based on the view's layoutMargins bottom inset. */ 137 | ALMarginBottom = NSLayoutAttributeBottomMargin, 138 | /** The leading margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */ 139 | ALMarginLeading = NSLayoutAttributeLeadingMargin, 140 | /** The trailing margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */ 141 | ALMarginTrailing = NSLayoutAttributeTrailingMargin 142 | }; 143 | 144 | /** Constants that represent axes of the layout margins of a view. Available in iOS 8.0 and later. */ 145 | typedef NS_ENUM(NSInteger, ALMarginAxis) { 146 | /** A vertical line through the middle of the view's left and right margins. */ 147 | ALMarginAxisVertical = NSLayoutAttributeCenterXWithinMargins, 148 | /** A horizontal line through the middle of the view's top and bottom margins. */ 149 | ALMarginAxisHorizontal = NSLayoutAttributeCenterYWithinMargins 150 | }; 151 | 152 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 153 | 154 | /** An attribute of a view that can be used in auto layout constraints. These constants are identical to the more specific enum types: 155 | ALEdge, ALAxis, ALDimension, ALMargin, ALMarginAxis. It is safe to cast a more specific enum type to the ALAttribute type. */ 156 | typedef NS_ENUM(NSInteger, ALAttribute) { 157 | /** The left edge of the view. */ 158 | ALAttributeLeft = ALEdgeLeft, 159 | /** The right edge of the view. */ 160 | ALAttributeRight = ALEdgeRight, 161 | /** The top edge of the view. */ 162 | ALAttributeTop = ALEdgeTop, 163 | /** The bottom edge of the view. */ 164 | ALAttributeBottom = ALEdgeBottom, 165 | /** The leading edge of the view (left edge for left-to-right languages like English, right edge for right-to-left languages like Arabic). */ 166 | ALAttributeLeading = ALEdgeLeading, 167 | /** The trailing edge of the view (right edge for left-to-right languages like English, left edge for right-to-left languages like Arabic). */ 168 | ALAttributeTrailing = ALEdgeTrailing, 169 | /** The width of the view. */ 170 | ALAttributeWidth = ALDimensionWidth, 171 | /** The height of the view. */ 172 | ALAttributeHeight = ALDimensionHeight, 173 | /** A vertical line through the middle of the view's left and right edges. */ 174 | ALAttributeVertical = ALAxisVertical, 175 | /** A horizontal line through the middle of the view's top and bottom edges. */ 176 | ALAttributeHorizontal = ALAxisHorizontal, 177 | /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) Same as ALAxisLastBaseline. */ 178 | ALAttributeBaseline = ALAxisBaseline, 179 | /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) */ 180 | ALAttributeLastBaseline = ALAxisLastBaseline, 181 | #if __PureLayout_MinBaseSDK_iOS_8_0 182 | /** A horizontal line at the baseline of the first line of text in a view. (For views that do not draw text, will be equivalent to ALEdgeTop.) Available in iOS 8.0 and later. */ 183 | ALAttributeFirstBaseline = ALAxisFirstBaseline, 184 | /** The left margin of the view, based on the view's layoutMargins left inset. */ 185 | ALAttributeMarginLeft = ALMarginLeft, 186 | /** The right margin of the view, based on the view's layoutMargins right inset. */ 187 | ALAttributeMarginRight = ALMarginRight, 188 | /** The top margin of the view, based on the view's layoutMargins top inset. */ 189 | ALAttributeMarginTop = ALMarginTop, 190 | /** The bottom margin of the view, based on the view's layoutMargins bottom inset. */ 191 | ALAttributeMarginBottom = ALMarginBottom, 192 | /** The leading margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */ 193 | ALAttributeMarginLeading = ALMarginLeading, 194 | /** The trailing margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */ 195 | ALAttributeMarginTrailing = ALMarginTrailing, 196 | /** A vertical line through the middle of the view's left and right margins. */ 197 | ALAttributeMarginAxisVertical = ALMarginAxisVertical, 198 | /** A horizontal line through the middle of the view's top and bottom margins. */ 199 | ALAttributeMarginAxisHorizontal = ALMarginAxisHorizontal 200 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 201 | }; 202 | 203 | /** A block containing method calls to the PureLayout API. Takes no arguments and has no return value. */ 204 | typedef void(^ALConstraintsBlock)(void); 205 | 206 | #endif /* PureLayoutDefines_h */ 207 | -------------------------------------------------------------------------------- /EFCalendarGraph/EFCalendarGraph.m: -------------------------------------------------------------------------------- 1 | // 2 | // EFCalendarGraph.m 3 | // EFCalendarGraph 4 | // 5 | // Created by Eliot Fowler on 7/6/15. 6 | // 7 | // 8 | 9 | #import "EFCalendarGraph.h" 10 | #import "NSDate+Utilities.h" 11 | 12 | const CGFloat EFCalendarGraphMinBoxSideLength = 3; 13 | const CGFloat EFCalendarGraphInterBoxMargin = 1; 14 | const NSInteger EFCalendarGraphDaysInWeek = 7; 15 | 16 | @interface EFCalendarGraph () 17 | 18 | // Public properties 19 | @property (nonatomic, strong) UIColor *borderColor; 20 | @property (nonatomic, assign) CGFloat borderWidth; 21 | 22 | // Private properties 23 | 24 | @property (nonatomic, strong) NSArray *layers; 25 | @property (nonatomic, strong) NSArray *dataByColumns; 26 | @property (nonatomic, strong) NSArray *layersByColumns; 27 | @property (nonatomic, strong) NSDate *endDate; 28 | @property (nonatomic, strong) NSDate *startDate; 29 | //@property (nonatomic, strong) NSArray *values; 30 | 31 | @property (nonatomic, assign, readonly) CGFloat minWidth; 32 | @property (nonatomic, assign, readonly) CGFloat minHeight; 33 | @property (nonatomic, assign, readonly) CGRect frameForViewInBounds; 34 | @property (nonatomic, assign, readonly) CGSize boxSize; 35 | @property (nonatomic, assign, readonly) NSInteger columns; 36 | @property (nonatomic, assign, readonly) NSInteger rows; 37 | @property (nonatomic, strong, readonly) id minValue; 38 | @property (nonatomic, strong, readonly) id maxValue; 39 | 40 | @end 41 | 42 | @implementation EFCalendarGraph { 43 | NSDate *_startDate; 44 | id _minValue; 45 | id _maxValue; 46 | } 47 | 48 | - (id)initWithCoder:(NSCoder *)aDecoder 49 | { 50 | if ((self = [super initWithCoder:aDecoder])) 51 | { 52 | [self initialize]; 53 | } 54 | return self; 55 | } 56 | 57 | - (instancetype)initWithFrame:(CGRect)frame 58 | { 59 | self = [self initWithStartDate:nil]; 60 | return self; 61 | } 62 | 63 | - (instancetype)initWithStartDate:(NSDate *)startDate 64 | { 65 | if ((self = [super initWithFrame:CGRectZero])) 66 | { 67 | _startDate = startDate; 68 | [self initialize]; 69 | } 70 | return self; 71 | } 72 | 73 | - (instancetype)initWithEndDate:(NSDate *)endDate 74 | { 75 | if ((self = [super initWithFrame:CGRectZero])) 76 | { 77 | _endDate = endDate; 78 | [self initialize]; 79 | } 80 | return self; 81 | } 82 | 83 | - (void)initialize 84 | { 85 | // Defaults 86 | self.backgroundColor = [UIColor redColor]; 87 | 88 | if (!self.borderColor) 89 | { 90 | self.borderColor = [UIColor blackColor]; 91 | } 92 | 93 | if (!self.borderWidth) 94 | { 95 | self.borderWidth = 2; 96 | } 97 | 98 | if (!self.startDate) 99 | { 100 | self.startDate = [NSDate new]; 101 | } 102 | 103 | if (!self.zeroColor) 104 | { 105 | self.zeroColor = [UIColor colorWithRed:.9 green:.9 blue:.9 alpha:.5]; 106 | } 107 | 108 | if (!self.baseColor) 109 | { 110 | self.baseColor = [UIColor colorWithRed:0 green:1 blue:0 alpha:1]; 111 | } 112 | 113 | if (!self.squareModifier) 114 | { 115 | self.squareModifier = EFCalendarGraphSquareModifierAlpha; 116 | } 117 | 118 | if (!self.modifierDenominations) 119 | { 120 | self.modifierDenominations = @[@.3, @.4, @.5, @.6, @.7, @.9]; 121 | } 122 | } 123 | 124 | -(void)layoutSubviews 125 | { 126 | [super layoutSubviews]; 127 | 128 | for (int i = 0; i < self.layers.count; i++) 129 | { 130 | CALayer *layer = self.layers[i]; 131 | layer.frame = [self rectForBoxWithDaysAfterStartDate:i]; 132 | } 133 | } 134 | 135 | #pragma mark - Overrides 136 | 137 | - (void)setStartDate:(NSDate *)startDate 138 | { 139 | _startDate = startDate; 140 | [self reloadData]; 141 | } 142 | 143 | - (NSDate *)startDate 144 | { 145 | if (!_startDate && _endDate) 146 | { 147 | NSUInteger numberOfDataPoints = [self.dataSource numberOfDataPointsInCalendarGraph:self]; 148 | _startDate = [_endDate dateBySubtractingDays:numberOfDataPoints-1]; 149 | } 150 | return _startDate; 151 | } 152 | 153 | - (NSArray *)dataByColumns 154 | { 155 | if (!_dataByColumns) 156 | { 157 | NSMutableArray *columnData = [NSMutableArray array]; 158 | NSUInteger numberOfDataPoints = [self.dataSource numberOfDataPointsInCalendarGraph:self]; 159 | for (int i = 0; i < numberOfDataPoints / EFCalendarGraphDaysInWeek; i++) 160 | { 161 | NSMutableArray *rowData = [NSMutableArray array]; 162 | for (int j = 0; j < EFCalendarGraphDaysInWeek; j++) 163 | { 164 | id dataPoint = [self valueForDaysAfterStartDate:i * EFCalendarGraphDaysInWeek + j]; 165 | [rowData addObject:dataPoint]; 166 | } 167 | [columnData addObject:rowData]; 168 | } 169 | 170 | _dataByColumns = [columnData copy]; 171 | } 172 | 173 | return _dataByColumns; 174 | } 175 | 176 | - (CGSize)contentSize 177 | { 178 | return CGSizeMake(CGRectGetWidth([self frameForViewInBounds]), CGRectGetHeight([self frameForViewInBounds])); 179 | } 180 | 181 | #pragma mark - Public methods 182 | 183 | - (void)reloadData 184 | { 185 | #if !TARGET_INTERFACE_BUILDER 186 | _dataByColumns = nil; 187 | #endif 188 | 189 | for(CALayer *layer in self.layer.sublayers) 190 | { 191 | [layer removeFromSuperlayer]; 192 | } 193 | 194 | NSMutableArray *layers = [NSMutableArray array]; 195 | NSMutableArray *layersByColumns = [NSMutableArray array]; 196 | for (int i = 0; i < self.dataByColumns.count; i++) 197 | { 198 | NSMutableArray *column = [NSMutableArray array]; 199 | for (int j = 0; j < EFCalendarGraphDaysInWeek; j++) 200 | { 201 | CALayer *layer = [CALayer layer]; 202 | CGRect boxFrame = [self rectForBoxWithDaysAfterStartDate:i * EFCalendarGraphDaysInWeek + j]; 203 | layer.frame = boxFrame; 204 | 205 | CGFloat value = [self.dataByColumns[i][j] floatValue]; 206 | if (value > 0) 207 | { 208 | CGFloat maxValue = [self.maxValue floatValue]; 209 | CGFloat minValue = [self.minValue floatValue]; 210 | CGFloat valuePerDenomination = ((maxValue - minValue + 1) / self.modifierDenominations.count); 211 | NSUInteger denominationIndex = value / valuePerDenomination - 1; 212 | CGFloat alpha = [self.modifierDenominations[denominationIndex] floatValue]; 213 | layer.backgroundColor = [self.baseColor colorWithAlphaComponent:alpha].CGColor; 214 | } 215 | else 216 | { 217 | layer.backgroundColor = self.zeroColor.CGColor; 218 | } 219 | [self.layer addSublayer:layer]; 220 | [layers addObject:layer]; 221 | [column addObject:layer]; 222 | } 223 | [layersByColumns addObject:column]; 224 | } 225 | 226 | self.layers = [layers copy]; 227 | self.layersByColumns = [layersByColumns copy]; 228 | 229 | if (self.automaticallyAdjustsFrameToContent) 230 | { 231 | self.frame = CGRectMake(CGRectGetMinX(self.frame), CGRectGetMinY(self.frame), self.contentSize.width, self.contentSize.height); 232 | } 233 | } 234 | 235 | #pragma mark - Helpers 236 | 237 | - (CGRect)rectForBoxWithDaysAfterStartDate:(NSInteger)daysAfterStartDate 238 | { 239 | CGRect frame = self.frameForViewInBounds; 240 | NSInteger column = [self columnForDaysAfterStartDate:daysAfterStartDate]; 241 | NSInteger row = [self rowForDaysAfterStartDate:daysAfterStartDate]; 242 | CGFloat x = CGRectGetMinX(frame) + 243 | self.boxSize.width * column + 244 | EFCalendarGraphInterBoxMargin * column + 245 | self.borderWidth; 246 | CGFloat y = CGRectGetMinY(frame) + 247 | self.boxSize.height * row + 248 | EFCalendarGraphInterBoxMargin * row + 249 | self.borderWidth; 250 | return CGRectMake(x, y, self.boxSize.width, self.boxSize.height); 251 | } 252 | 253 | - (NSInteger)columnForDaysAfterStartDate:(NSInteger)daysAfterStartDate 254 | { 255 | // 1 is Sunday and I want 0 to be Sunday 256 | NSInteger startDateWeekOffset = self.startDate.weekday - 1; 257 | return (daysAfterStartDate + startDateWeekOffset) / EFCalendarGraphDaysInWeek; 258 | } 259 | 260 | - (NSInteger)rowForDaysAfterStartDate:(NSInteger)daysAfterStartDate 261 | { 262 | NSDate *rowDate = [self.startDate dateByAddingDays:daysAfterStartDate]; 263 | 264 | // 1 is Sunday and I want 0 to be Sunday 265 | return rowDate.weekday - 1; 266 | } 267 | 268 | - (id)valueForDaysAfterStartDate:(NSUInteger)daysAfterStartDate 269 | { 270 | NSDate *date = [self.startDate dateByAddingDays:daysAfterStartDate]; 271 | NSUInteger daysBeforeEnd = [date daysBeforeDate:self.endDate]; 272 | return [self.dataSource calendarGraph:self valueForDate:date 273 | daysAfterStartDate:daysAfterStartDate 274 | daysBeforeEndDate:daysBeforeEnd]; 275 | } 276 | 277 | #pragma mark - Read-only property getters 278 | 279 | - (CGRect)frameForViewInBounds 280 | { 281 | if (CGRectEqualToRect(self.bounds, CGRectZero)) 282 | { 283 | return CGRectZero; 284 | } 285 | 286 | CGFloat width = self.minWidth; 287 | CGFloat height = self.minHeight; 288 | CGFloat x = 0; 289 | CGFloat y = 0; 290 | 291 | if (width > height && width < CGRectGetWidth(self.bounds)) 292 | { 293 | width = CGRectGetWidth(self.bounds); 294 | CGFloat boxWidth = [self boxWidthBasedOnBoundsWidth:width]; 295 | height = 2 * self.borderWidth + 296 | EFCalendarGraphDaysInWeek * boxWidth + 297 | (self.rows - 1) * EFCalendarGraphInterBoxMargin; 298 | } 299 | else if (height > width && height < CGRectGetHeight(self.bounds)) 300 | { 301 | height = CGRectGetHeight(self.bounds); 302 | CGFloat boxHeight = [self boxHeightBasedOnBoundsHeight:height]; 303 | width = 2 * self.borderWidth + 304 | self.columns * boxHeight + 305 | self.columns - 1 * EFCalendarGraphInterBoxMargin; 306 | } 307 | 308 | // Now that we know for sure that one of the edges is touching its bounds edge, 309 | // we need to check again if one of the edges is still off so we can center in 310 | // that dimension 311 | if (width < CGRectGetWidth(self.bounds)) 312 | { 313 | CGFloat widthDifference = CGRectGetWidth(self.bounds) - width; 314 | x = widthDifference/2; 315 | } 316 | else if (height < CGRectGetHeight(self.bounds)) 317 | { 318 | CGFloat heightDifference = CGRectGetHeight(self.bounds) - height; 319 | y = heightDifference/2; 320 | } 321 | 322 | return CGRectMake(x, y, width, height); 323 | } 324 | 325 | - (CGFloat)boxWidthBasedOnBoundsWidth:(CGFloat)width 326 | { 327 | return MAX((width - 328 | EFCalendarGraphInterBoxMargin * (self.columns - 1) - 329 | self.borderWidth * 2) / self.columns, EFCalendarGraphMinBoxSideLength); 330 | } 331 | 332 | - (CGFloat)boxHeightBasedOnBoundsHeight:(CGFloat)height 333 | { 334 | return MAX((height - 335 | EFCalendarGraphInterBoxMargin * (self.rows - 1) - 336 | self.borderWidth * 2) / self.rows, EFCalendarGraphMinBoxSideLength); 337 | } 338 | 339 | - (CGSize)boxSize 340 | { 341 | CGRect frame = self.frameForViewInBounds; 342 | CGFloat width = [self boxWidthBasedOnBoundsWidth:CGRectGetWidth(frame)]; 343 | CGFloat height = [self boxHeightBasedOnBoundsHeight:CGRectGetHeight(frame)]; 344 | 345 | NSAssert(fabs(width - height) < .01, @"Box not square; width: %f, height: %f", width, height); 346 | 347 | return CGSizeMake(width, height); 348 | } 349 | 350 | - (CGFloat)minWidth 351 | { 352 | return 2 * self.borderWidth + 353 | self.dataByColumns.count * EFCalendarGraphMinBoxSideLength + 354 | self.dataByColumns.count - 1 * EFCalendarGraphInterBoxMargin; 355 | } 356 | 357 | - (CGFloat)minHeight 358 | { 359 | return 2 * self.borderWidth + 360 | EFCalendarGraphDaysInWeek * EFCalendarGraphMinBoxSideLength + 361 | (EFCalendarGraphDaysInWeek - 1) * EFCalendarGraphInterBoxMargin; 362 | } 363 | 364 | - (NSInteger)columns 365 | { 366 | return [self columnForDaysAfterStartDate:(self.dataByColumns.count - 1) * EFCalendarGraphDaysInWeek + EFCalendarGraphDaysInWeek - 1] + 1; 367 | } 368 | 369 | - (NSInteger)rows 370 | { 371 | return EFCalendarGraphDaysInWeek; 372 | } 373 | 374 | - (id)minValue 375 | { 376 | if (!_minValue) 377 | { 378 | id minValue = @(MAXFLOAT); 379 | NSUInteger numberOfDataPoints = [self.dataSource numberOfDataPointsInCalendarGraph:self]; 380 | for (int i = 0; i < numberOfDataPoints; i++) 381 | { 382 | id value = [self valueForDaysAfterStartDate:i]; 383 | if ([value floatValue] < [minValue floatValue] && [value floatValue] > 0) 384 | { 385 | minValue = value; 386 | } 387 | } 388 | _minValue = minValue; 389 | } 390 | 391 | return _minValue; 392 | } 393 | 394 | - (id)maxValue 395 | { 396 | if (!_maxValue) 397 | { 398 | id maxValue = @(0); 399 | NSUInteger numberOfDataPoints = [self.dataSource numberOfDataPointsInCalendarGraph:self]; 400 | for (int i = 0; i < numberOfDataPoints; i++) 401 | { 402 | id value = [self valueForDaysAfterStartDate:i]; 403 | if ([value floatValue] > [maxValue floatValue]) 404 | { 405 | maxValue = value; 406 | } 407 | } 408 | _maxValue = maxValue; 409 | } 410 | 411 | return _maxValue; 412 | } 413 | 414 | #pragma mark - For Storyboards 415 | 416 | - (void)prepareForInterfaceBuilder 417 | { 418 | // Fake Data 419 | NSMutableArray *values = [NSMutableArray array]; 420 | for (int i = 0; i < 365; i++) 421 | { 422 | [values addObject:arc4random() % 2 == 0 ? @0 : @(arc4random() % 5)]; 423 | } 424 | 425 | NSMutableArray *columnData = [NSMutableArray array]; 426 | for (int i = 0; i < values.count / EFCalendarGraphDaysInWeek; i++) 427 | { 428 | NSMutableArray *rowData = [NSMutableArray array]; 429 | for (int j = 0; j < EFCalendarGraphDaysInWeek; j++) 430 | { 431 | id dataPoint = values[i * EFCalendarGraphDaysInWeek + j]; 432 | [rowData addObject:dataPoint]; 433 | } 434 | [columnData addObject:rowData]; 435 | } 436 | 437 | self.dataByColumns = [columnData copy]; 438 | 439 | self.dataSource = self; 440 | [self reloadData]; 441 | } 442 | 443 | - (id)calendarGraph:(EFCalendarGraph *)calendarGraph valueForDate:(NSDate *)date daysAfterStartDate:(NSUInteger)daysAfterStartDate daysBeforeEndDate:(NSUInteger)daysBeforeEndDate 444 | { 445 | NSUInteger i = daysAfterStartDate / EFCalendarGraphDaysInWeek; 446 | NSUInteger j = daysAfterStartDate % EFCalendarGraphDaysInWeek; 447 | return self.dataByColumns[i][j]; 448 | } 449 | 450 | - (NSUInteger)numberOfDataPointsInCalendarGraph:(EFCalendarGraph *)calendarGraph 451 | { 452 | return self.dataByColumns.count; 453 | } 454 | 455 | @end 456 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/ALView+PureLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // ALView+PureLayout.h 3 | // v2.0.5 4 | // https://github.com/smileyborg/PureLayout 5 | // 6 | // Copyright (c) 2012 Richard Turton 7 | // Copyright (c) 2013-2015 Tyler Fox 8 | // 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy 12 | // of this software and associated documentation files (the "Software"), to 13 | // deal in the Software without restriction, including without limitation the 14 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 15 | // sell copies of the Software, and to permit persons to whom the Software is 16 | // furnished to do so, subject to the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be included in 19 | // all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 27 | // IN THE SOFTWARE. 28 | // 29 | 30 | #import "PureLayoutDefines.h" 31 | 32 | 33 | #pragma mark - ALView+PureLayout 34 | 35 | /** 36 | A category on UIView/NSView that provides a simple yet powerful interface for creating Auto Layout constraints. 37 | */ 38 | @interface ALView (PureLayout) 39 | 40 | 41 | #pragma mark Factory & Initializer Methods 42 | 43 | /** Creates and returns a new view that does not convert the autoresizing mask into constraints. */ 44 | + (instancetype)newAutoLayoutView; 45 | 46 | /** Initializes and returns a new view that does not convert the autoresizing mask into constraints. */ 47 | - (instancetype)initForAutoLayout; 48 | 49 | 50 | #pragma mark Create Constraints Without Installing 51 | 52 | /** Prevents constraints created in the given constraints block from being automatically installed (activated). 53 | The constraints created from calls to the PureLayout API in the block are returned in a single array. */ 54 | + (NSArray *)autoCreateConstraintsWithoutInstalling:(ALConstraintsBlock)block; 55 | 56 | 57 | #pragma mark Set Priority For Constraints 58 | 59 | /** Sets the constraint priority to the given value for all constraints created using the PureLayout API within the given constraints block. 60 | NOTE: This method will have no effect (and will NOT set the priority) on constraints created or added without using the PureLayout API! */ 61 | + (void)autoSetPriority:(ALLayoutPriority)priority forConstraints:(ALConstraintsBlock)block; 62 | 63 | 64 | #pragma mark Set Identifier For Constraints 65 | 66 | #if __PureLayout_MinBaseSDK_iOS_8_0 67 | 68 | /** Sets the identifier for all constraints created using the PureLayout API within the given constraints block. 69 | NOTE: This method will have no effect (and will NOT set the identifier) on constraints created or added without using the PureLayout API! */ 70 | + (void)autoSetIdentifier:(NSString *)identifier forConstraints:(ALConstraintsBlock)block; 71 | 72 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 73 | 74 | 75 | #pragma mark Center & Align in Superview 76 | 77 | /** Centers the view in its superview. */ 78 | - (NSArray *)autoCenterInSuperview; 79 | 80 | /** Aligns the view to the same axis of its superview. */ 81 | - (NSLayoutConstraint *)autoAlignAxisToSuperviewAxis:(ALAxis)axis; 82 | 83 | #if __PureLayout_MinBaseSDK_iOS_8_0 84 | 85 | /** Centers the view in its superview's margins. Available in iOS 8.0 and later. */ 86 | - (NSArray *)autoCenterInSuperviewMargins; 87 | 88 | /** Aligns the view to the corresponding margin axis of its superview. Available in iOS 8.0 and later. */ 89 | - (NSLayoutConstraint *)autoAlignAxisToSuperviewMarginAxis:(ALAxis)axis; 90 | 91 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 92 | 93 | 94 | #pragma mark Pin Edges to Superview 95 | 96 | /** Pins the given edge of the view to the same edge of its superview. */ 97 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge; 98 | 99 | /** Pins the given edge of the view to the same edge of its superview with an inset. */ 100 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset; 101 | 102 | /** Pins the given edge of the view to the same edge of its superview with an inset as a maximum or minimum. */ 103 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset relation:(NSLayoutRelation)relation; 104 | 105 | /** Pins the edges of the view to the edges of its superview with the given edge insets. */ 106 | - (NSArray *)autoPinEdgesToSuperviewEdgesWithInsets:(ALEdgeInsets)insets; 107 | 108 | /** Pins 3 of the 4 edges of the view to the edges of its superview with the given edge insets, excluding one edge. */ 109 | - (NSArray *)autoPinEdgesToSuperviewEdgesWithInsets:(ALEdgeInsets)insets excludingEdge:(ALEdge)edge; 110 | 111 | #if __PureLayout_MinBaseSDK_iOS_8_0 112 | 113 | /** Pins the given edge of the view to the corresponding margin of its superview. Available in iOS 8.0 and later. */ 114 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewMargin:(ALEdge)edge; 115 | 116 | /** Pins the given edge of the view to the corresponding margin of its superview as a maximum or minimum. Available in iOS 8.0 and later. */ 117 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewMargin:(ALEdge)edge relation:(NSLayoutRelation)relation; 118 | 119 | /** Pins the edges of the view to the margins of its superview. Available in iOS 8.0 and later. */ 120 | - (NSArray *)autoPinEdgesToSuperviewMargins; 121 | 122 | /** Pins 3 of the 4 edges of the view to the margins of its superview excluding one edge. Available in iOS 8.0 and later. */ 123 | - (NSArray *)autoPinEdgesToSuperviewMarginsExcludingEdge:(ALEdge)edge; 124 | 125 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 126 | 127 | 128 | #pragma mark Pin Edges 129 | 130 | /** Pins an edge of the view to a given edge of another view. */ 131 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView; 132 | 133 | /** Pins an edge of the view to a given edge of another view with an offset. */ 134 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView withOffset:(CGFloat)offset; 135 | 136 | /** Pins an edge of the view to a given edge of another view with an offset as a maximum or minimum. */ 137 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 138 | 139 | 140 | #pragma mark Align Axes 141 | 142 | /** Aligns an axis of the view to the same axis of another view. */ 143 | - (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView; 144 | 145 | /** Aligns an axis of the view to the same axis of another view with an offset. */ 146 | - (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView withOffset:(CGFloat)offset; 147 | 148 | 149 | #pragma mark Match Dimensions 150 | 151 | /** Matches a dimension of the view to a given dimension of another view. */ 152 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView; 153 | 154 | /** Matches a dimension of the view to a given dimension of another view with an offset. */ 155 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withOffset:(CGFloat)offset; 156 | 157 | /** Matches a dimension of the view to a given dimension of another view with an offset as a maximum or minimum. */ 158 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 159 | 160 | /** Matches a dimension of the view to a multiple of a given dimension of another view. */ 161 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier; 162 | 163 | /** Matches a dimension of the view to a multiple of a given dimension of another view as a maximum or minimum. */ 164 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation; 165 | 166 | 167 | #pragma mark Set Dimensions 168 | 169 | /** Sets the view to a specific size. */ 170 | - (NSArray *)autoSetDimensionsToSize:(CGSize)size; 171 | 172 | /** Sets the given dimension of the view to a specific size. */ 173 | - (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size; 174 | 175 | /** Sets the given dimension of the view to a specific size as a maximum or minimum. */ 176 | - (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size relation:(NSLayoutRelation)relation; 177 | 178 | 179 | #pragma mark Set Content Compression Resistance & Hugging 180 | 181 | /** Sets the priority of content compression resistance for an axis. 182 | NOTE: This method must be called from within the block passed into the method +[UIView autoSetPriority:forConstraints:] */ 183 | - (void)autoSetContentCompressionResistancePriorityForAxis:(ALAxis)axis; 184 | 185 | /** Sets the priority of content hugging for an axis. 186 | NOTE: This method must be called from within the block passed into the method +[UIView autoSetPriority:forConstraints:] */ 187 | - (void)autoSetContentHuggingPriorityForAxis:(ALAxis)axis; 188 | 189 | 190 | #pragma mark Constrain Any Attributes 191 | 192 | /** Constrains an attribute of the view to a given attribute of another view. */ 193 | - (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView; 194 | 195 | /** Constrains an attribute of the view to a given attribute of another view with an offset. */ 196 | - (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withOffset:(CGFloat)offset; 197 | 198 | /** Constrains an attribute of the view to a given attribute of another view with an offset as a maximum or minimum. */ 199 | - (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 200 | 201 | /** Constrains an attribute of the view to a given attribute of another view with a multiplier. */ 202 | - (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier; 203 | 204 | /** Constrains an attribute of the view to a given attribute of another view with a multiplier as a maximum or minimum. */ 205 | - (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation; 206 | 207 | 208 | #pragma mark Pin to Layout Guides (iOS only) 209 | 210 | #if TARGET_OS_IPHONE 211 | 212 | /** Pins the top edge of the view to the top layout guide of the given view controller with an inset. Available on iOS only. */ 213 | - (NSLayoutConstraint *)autoPinToTopLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset; 214 | 215 | /** Pins the top edge of the view to the top layout guide of the given view controller with an inset as a maximum or minimum. Available on iOS only. */ 216 | - (NSLayoutConstraint *)autoPinToTopLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset relation:(NSLayoutRelation)relation; 217 | 218 | /** Pins the bottom edge of the view to the bottom layout guide of the given view controller with an inset. Available on iOS only. */ 219 | - (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset; 220 | 221 | /** Pins the bottom edge of the view to the bottom layout guide of the given view controller with an inset as a maximum or minimum. Available on iOS only. */ 222 | - (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset relation:(NSLayoutRelation)relation; 223 | 224 | #endif /* TARGET_OS_IPHONE */ 225 | 226 | 227 | #pragma mark Deprecated Methods 228 | 229 | /** DEPRECATED as of PureLayout v2.0.0. Retain a reference to and remove specific constraints instead, or recreate the view(s) entirely to remove all constraints. 230 | Removes all explicit constraints that affect the view. 231 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 232 | NOTE: This method preserves implicit constraints, such as intrinsic content size constraints, which you usually do not want to remove. */ 233 | - (void)autoRemoveConstraintsAffectingView __attribute__((deprecated)); 234 | 235 | /** DEPRECATED as of PureLayout v2.0.0. Retain a reference to and remove specific constraints instead, or recreate the view(s) entirely to remove all constraints. 236 | Removes all constraints that affect the view, optionally including implicit constraints. 237 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 238 | NOTE: Implicit constraints are auto-generated lower priority constraints, and you usually do not want to remove these. */ 239 | - (void)autoRemoveConstraintsAffectingViewIncludingImplicitConstraints:(BOOL)shouldRemoveImplicitConstraints __attribute__((deprecated)); 240 | 241 | /** DEPRECATED as of PureLayout v2.0.0. Retain a reference to and remove specific constraints instead, or recreate the view(s) entirely to remove all constraints. 242 | Recursively removes all explicit constraints that affect the view and its subviews. 243 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 244 | NOTE: This method preserves implicit constraints, such as intrinsic content size constraints, which you usually do not want to remove. */ 245 | - (void)autoRemoveConstraintsAffectingViewAndSubviews __attribute__((deprecated)); 246 | 247 | /** DEPRECATED as of PureLayout v2.0.0. Retain a reference to and remove specific constraints instead, or recreate the view(s) entirely to remove all constraints. 248 | Recursively removes all constraints from the view and its subviews, optionally including implicit constraints. 249 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 250 | NOTE: Implicit constraints are auto-generated lower priority constraints, and you usually do not want to remove these. */ 251 | - (void)autoRemoveConstraintsAffectingViewAndSubviewsIncludingImplicitConstraints:(BOOL)shouldRemoveImplicitConstraints __attribute__((deprecated)); 252 | 253 | @end 254 | -------------------------------------------------------------------------------- /EFCalendarGraph/NSDate+Utilities.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+Utilties.m 3 | // Crossword 4 | // 5 | // Created by Erica Sadun 6 | // 7 | 8 | #import "NSDate+Utilities.h" 9 | 10 | static const unsigned componentFlags = (NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekOfYear | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond | NSCalendarUnitWeekday | NSCalendarUnitWeekdayOrdinal); 11 | 12 | 13 | @implementation NSDate (Utilties) 14 | 15 | // Courtesy of Lukasz Margielewski 16 | // Updated via Holger Haenisch 17 | + (NSCalendar *)currentCalendar 18 | { 19 | static NSCalendar *sharedCalendar = nil; 20 | if (!sharedCalendar) 21 | sharedCalendar = [NSCalendar autoupdatingCurrentCalendar]; 22 | return sharedCalendar; 23 | } 24 | 25 | #pragma mark - Relative Dates 26 | 27 | + (NSDate *)dateWithDaysFromNow:(NSInteger)days 28 | { 29 | // Thanks, Jim Morrison 30 | return [[NSDate date] dateByAddingDays:days]; 31 | } 32 | 33 | + (NSDate *)dateWithDaysBeforeNow:(NSInteger)days 34 | { 35 | // Thanks, Jim Morrison 36 | return [[NSDate date] dateBySubtractingDays:days]; 37 | } 38 | 39 | + (NSDate *)dateTomorrow 40 | { 41 | return [NSDate dateWithDaysFromNow:1]; 42 | } 43 | 44 | + (NSDate *)dateYesterday 45 | { 46 | return [NSDate dateWithDaysBeforeNow:1]; 47 | } 48 | 49 | + (NSDate *)dateWithHoursFromNow:(NSInteger)dHours 50 | { 51 | NSTimeInterval aTimeInterval = [[NSDate date] timeIntervalSinceReferenceDate] + D_HOUR * dHours; 52 | NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; 53 | return newDate; 54 | } 55 | 56 | + (NSDate *)dateWithHoursBeforeNow:(NSInteger)dHours 57 | { 58 | NSTimeInterval aTimeInterval = [[NSDate date] timeIntervalSinceReferenceDate] - D_HOUR * dHours; 59 | NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; 60 | return newDate; 61 | } 62 | 63 | + (NSDate *)dateWithMinutesFromNow:(NSInteger)dMinutes 64 | { 65 | NSTimeInterval aTimeInterval = [[NSDate date] timeIntervalSinceReferenceDate] + D_MINUTE * dMinutes; 66 | NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; 67 | return newDate; 68 | } 69 | 70 | + (NSDate *)dateWithMinutesBeforeNow:(NSInteger)dMinutes 71 | { 72 | NSTimeInterval aTimeInterval = [[NSDate date] timeIntervalSinceReferenceDate] - D_MINUTE * dMinutes; 73 | NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; 74 | return newDate; 75 | } 76 | 77 | #pragma mark - String Properties 78 | - (NSString *)stringWithFormat:(NSString *)format 79 | { 80 | NSDateFormatter *formatter = [NSDateFormatter new]; 81 | // formatter.locale = [NSLocale currentLocale]; // Necessary? 82 | formatter.dateFormat = format; 83 | return [formatter stringFromDate:self]; 84 | } 85 | 86 | - (NSString *)stringWithDateStyle:(NSDateFormatterStyle)dateStyle timeStyle:(NSDateFormatterStyle)timeStyle 87 | { 88 | NSDateFormatter *formatter = [NSDateFormatter new]; 89 | formatter.dateStyle = dateStyle; 90 | formatter.timeStyle = timeStyle; 91 | // formatter.locale = [NSLocale currentLocale]; // Necessary? 92 | return [formatter stringFromDate:self]; 93 | } 94 | 95 | - (NSString *)shortString 96 | { 97 | return [self stringWithDateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle]; 98 | } 99 | 100 | - (NSString *)shortTimeString 101 | { 102 | return [self stringWithDateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle]; 103 | } 104 | 105 | - (NSString *)shortDateString 106 | { 107 | return [self stringWithDateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterNoStyle]; 108 | } 109 | 110 | - (NSString *)mediumString 111 | { 112 | return [self stringWithDateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterMediumStyle]; 113 | } 114 | 115 | - (NSString *)mediumTimeString 116 | { 117 | return [self stringWithDateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterMediumStyle]; 118 | } 119 | 120 | - (NSString *)mediumDateString 121 | { 122 | return [self stringWithDateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterNoStyle]; 123 | } 124 | 125 | - (NSString *)longString 126 | { 127 | return [self stringWithDateStyle:NSDateFormatterLongStyle timeStyle:NSDateFormatterLongStyle]; 128 | } 129 | 130 | - (NSString *)longTimeString 131 | { 132 | return [self stringWithDateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterLongStyle]; 133 | } 134 | 135 | - (NSString *)longDateString 136 | { 137 | return [self stringWithDateStyle:NSDateFormatterLongStyle timeStyle:NSDateFormatterNoStyle]; 138 | } 139 | 140 | #pragma mark - Comparing Dates 141 | 142 | - (BOOL)isEqualToDateIgnoringTime:(NSDate *)aDate 143 | { 144 | NSDateComponents *components1 = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 145 | NSDateComponents *components2 = [[NSDate currentCalendar] components:componentFlags fromDate:aDate]; 146 | return ((components1.year == components2.year) && 147 | (components1.month == components2.month) && 148 | (components1.day == components2.day)); 149 | } 150 | 151 | - (BOOL)isToday 152 | { 153 | return [self isEqualToDateIgnoringTime:[NSDate date]]; 154 | } 155 | 156 | - (BOOL)isTomorrow 157 | { 158 | return [self isEqualToDateIgnoringTime:[NSDate dateTomorrow]]; 159 | } 160 | 161 | - (BOOL)isYesterday 162 | { 163 | return [self isEqualToDateIgnoringTime:[NSDate dateYesterday]]; 164 | } 165 | 166 | // This hard codes the assumption that a week is 7 days 167 | - (BOOL)isSameWeekAsDate:(NSDate *)aDate 168 | { 169 | NSDateComponents *components1 = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 170 | NSDateComponents *components2 = [[NSDate currentCalendar] components:componentFlags fromDate:aDate]; 171 | 172 | // Must be same week. 12/31 and 1/1 will both be week "1" if they are in the same week 173 | if (components1.weekOfYear != components2.weekOfYear) return NO; 174 | 175 | // Must have a time interval under 1 week. Thanks @aclark 176 | return (fabs([self timeIntervalSinceDate:aDate]) < D_WEEK); 177 | } 178 | 179 | - (BOOL)isThisWeek 180 | { 181 | return [self isSameWeekAsDate:[NSDate date]]; 182 | } 183 | 184 | - (BOOL)isNextWeek 185 | { 186 | NSTimeInterval aTimeInterval = [[NSDate date] timeIntervalSinceReferenceDate] + D_WEEK; 187 | NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; 188 | return [self isSameWeekAsDate:newDate]; 189 | } 190 | 191 | - (BOOL)isLastWeek 192 | { 193 | NSTimeInterval aTimeInterval = [[NSDate date] timeIntervalSinceReferenceDate] - D_WEEK; 194 | NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; 195 | return [self isSameWeekAsDate:newDate]; 196 | } 197 | 198 | // Thanks, mspasov 199 | - (BOOL)isSameMonthAsDate:(NSDate *)aDate 200 | { 201 | NSDateComponents *components1 = [[NSDate currentCalendar] components:NSCalendarUnitYear | NSCalendarUnitMonth fromDate:self]; 202 | NSDateComponents *components2 = [[NSDate currentCalendar] components:NSCalendarUnitYear | NSCalendarUnitMonth fromDate:aDate]; 203 | return ((components1.month == components2.month) && 204 | (components1.year == components2.year)); 205 | } 206 | 207 | - (BOOL)isThisMonth 208 | { 209 | return [self isSameMonthAsDate:[NSDate date]]; 210 | } 211 | 212 | // Thanks Marcin Krzyzanowski, also for adding/subtracting years and months 213 | - (BOOL)isLastMonth 214 | { 215 | return [self isSameMonthAsDate:[[NSDate date] dateBySubtractingMonths:1]]; 216 | } 217 | 218 | - (BOOL)isNextMonth 219 | { 220 | return [self isSameMonthAsDate:[[NSDate date] dateByAddingMonths:1]]; 221 | } 222 | 223 | - (BOOL)isSameYearAsDate:(NSDate *)aDate 224 | { 225 | NSDateComponents *components1 = [[NSDate currentCalendar] components:NSCalendarUnitYear fromDate:self]; 226 | NSDateComponents *components2 = [[NSDate currentCalendar] components:NSCalendarUnitYear fromDate:aDate]; 227 | return (components1.year == components2.year); 228 | } 229 | 230 | - (BOOL)isThisYear 231 | { 232 | // Thanks, baspellis 233 | return [self isSameYearAsDate:[NSDate date]]; 234 | } 235 | 236 | - (BOOL)isNextYear 237 | { 238 | NSDateComponents *components1 = [[NSDate currentCalendar] components:NSCalendarUnitYear fromDate:self]; 239 | NSDateComponents *components2 = [[NSDate currentCalendar] components:NSCalendarUnitYear fromDate:[NSDate date]]; 240 | 241 | return (components1.year == (components2.year + 1)); 242 | } 243 | 244 | - (BOOL)isLastYear 245 | { 246 | NSDateComponents *components1 = [[NSDate currentCalendar] components:NSCalendarUnitYear fromDate:self]; 247 | NSDateComponents *components2 = [[NSDate currentCalendar] components:NSCalendarUnitYear fromDate:[NSDate date]]; 248 | 249 | return (components1.year == (components2.year - 1)); 250 | } 251 | 252 | - (BOOL)isEarlierThanDate:(NSDate *)aDate 253 | { 254 | return ([self compare:aDate] == NSOrderedAscending); 255 | } 256 | 257 | - (BOOL)isLaterThanDate:(NSDate *)aDate 258 | { 259 | return ([self compare:aDate] == NSOrderedDescending); 260 | } 261 | 262 | // Thanks, markrickert 263 | - (BOOL)isInFuture 264 | { 265 | return ([self isLaterThanDate:[NSDate date]]); 266 | } 267 | 268 | // Thanks, markrickert 269 | - (BOOL)isInPast 270 | { 271 | return ([self isEarlierThanDate:[NSDate date]]); 272 | } 273 | 274 | 275 | #pragma mark - Roles 276 | - (BOOL)isTypicallyWeekend 277 | { 278 | NSDateComponents *components = [[NSDate currentCalendar] components:NSCalendarUnitWeekday fromDate:self]; 279 | if ((components.weekday == 1) || 280 | (components.weekday == 7)) 281 | return YES; 282 | return NO; 283 | } 284 | 285 | - (BOOL)isTypicallyWorkday 286 | { 287 | return ![self isTypicallyWeekend]; 288 | } 289 | 290 | #pragma mark - Adjusting Dates 291 | 292 | // Thaks, rsjohnson 293 | - (NSDate *)dateByAddingYears:(NSInteger)dYears 294 | { 295 | NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; 296 | [dateComponents setYear:dYears]; 297 | NSDate *newDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:self options:0]; 298 | return newDate; 299 | } 300 | 301 | - (NSDate *)dateBySubtractingYears:(NSInteger)dYears 302 | { 303 | return [self dateByAddingYears:-dYears]; 304 | } 305 | 306 | - (NSDate *)dateByAddingMonths:(NSInteger)dMonths 307 | { 308 | NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; 309 | [dateComponents setMonth:dMonths]; 310 | NSDate *newDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:self options:0]; 311 | return newDate; 312 | } 313 | 314 | - (NSDate *)dateBySubtractingMonths:(NSInteger)dMonths 315 | { 316 | return [self dateByAddingMonths:-dMonths]; 317 | } 318 | 319 | // Courtesy of dedan who mentions issues with Daylight Savings 320 | - (NSDate *)dateByAddingDays:(NSInteger)dDays 321 | { 322 | NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; 323 | [dateComponents setDay:dDays]; 324 | NSDate *newDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:self options:0]; 325 | return newDate; 326 | } 327 | 328 | - (NSDate *)dateBySubtractingDays:(NSInteger)dDays 329 | { 330 | return [self dateByAddingDays:(dDays * -1)]; 331 | } 332 | 333 | - (NSDate *)dateByAddingHours:(NSInteger)dHours 334 | { 335 | NSTimeInterval aTimeInterval = [self timeIntervalSinceReferenceDate] + D_HOUR * dHours; 336 | NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; 337 | return newDate; 338 | } 339 | 340 | - (NSDate *)dateBySubtractingHours:(NSInteger)dHours 341 | { 342 | return [self dateByAddingHours:(dHours * -1)]; 343 | } 344 | 345 | - (NSDate *)dateByAddingMinutes:(NSInteger)dMinutes 346 | { 347 | NSTimeInterval aTimeInterval = [self timeIntervalSinceReferenceDate] + D_MINUTE * dMinutes; 348 | NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; 349 | return newDate; 350 | } 351 | 352 | - (NSDate *)dateBySubtractingMinutes:(NSInteger)dMinutes 353 | { 354 | return [self dateByAddingMinutes:(dMinutes * -1)]; 355 | } 356 | 357 | - (NSDateComponents *)componentsWithOffsetFromDate:(NSDate *)aDate 358 | { 359 | NSDateComponents *dTime = [[NSDate currentCalendar] components:componentFlags fromDate:aDate toDate:self options:0]; 360 | return dTime; 361 | } 362 | 363 | #pragma mark - Extremes 364 | 365 | - (NSDate *)dateAtStartOfDay 366 | { 367 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 368 | components.hour = 0; 369 | components.minute = 0; 370 | components.second = 0; 371 | return [[NSDate currentCalendar] dateFromComponents:components]; 372 | } 373 | 374 | // Thanks gsempe & mteece 375 | - (NSDate *)dateAtEndOfDay 376 | { 377 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 378 | components.hour = 23; // Thanks Aleksey Kononov 379 | components.minute = 59; 380 | components.second = 59; 381 | return [[NSDate currentCalendar] dateFromComponents:components]; 382 | } 383 | 384 | #pragma mark - Retrieving Intervals 385 | 386 | - (NSInteger)minutesAfterDate:(NSDate *)aDate 387 | { 388 | NSTimeInterval ti = [self timeIntervalSinceDate:aDate]; 389 | return (NSInteger)(ti / D_MINUTE); 390 | } 391 | 392 | - (NSInteger)minutesBeforeDate:(NSDate *)aDate 393 | { 394 | NSTimeInterval ti = [aDate timeIntervalSinceDate:self]; 395 | return (NSInteger)(ti / D_MINUTE); 396 | } 397 | 398 | - (NSInteger)hoursAfterDate:(NSDate *)aDate 399 | { 400 | NSTimeInterval ti = [self timeIntervalSinceDate:aDate]; 401 | return (NSInteger)(ti / D_HOUR); 402 | } 403 | 404 | - (NSInteger)hoursBeforeDate:(NSDate *)aDate 405 | { 406 | NSTimeInterval ti = [aDate timeIntervalSinceDate:self]; 407 | return (NSInteger)(ti / D_HOUR); 408 | } 409 | 410 | - (NSInteger)daysAfterDate:(NSDate *)aDate 411 | { 412 | NSTimeInterval ti = [self timeIntervalSinceDate:aDate]; 413 | return (NSInteger)(ti / D_DAY); 414 | } 415 | 416 | - (NSInteger)daysBeforeDate:(NSDate *)aDate 417 | { 418 | NSTimeInterval ti = [aDate timeIntervalSinceDate:self]; 419 | return (NSInteger)(ti / D_DAY); 420 | } 421 | 422 | // Thanks, dmitrydims 423 | // I have not yet thoroughly tested this 424 | - (NSInteger)distanceInDaysToDate:(NSDate *)anotherDate 425 | { 426 | NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 427 | NSDateComponents *components = [gregorianCalendar components:NSCalendarUnitDay fromDate:self toDate:anotherDate options:0]; 428 | return components.day; 429 | } 430 | 431 | #pragma mark - Decomposing Dates 432 | 433 | - (NSInteger)nearestHour 434 | { 435 | NSTimeInterval aTimeInterval = [[NSDate date] timeIntervalSinceReferenceDate] + D_MINUTE * 30; 436 | NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval]; 437 | NSDateComponents *components = [[NSDate currentCalendar] components:NSCalendarUnitHour fromDate:newDate]; 438 | return components.hour; 439 | } 440 | 441 | - (NSInteger)hour 442 | { 443 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 444 | return components.hour; 445 | } 446 | 447 | - (NSInteger)minute 448 | { 449 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 450 | return components.minute; 451 | } 452 | 453 | - (NSInteger)seconds 454 | { 455 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 456 | return components.second; 457 | } 458 | 459 | - (NSInteger)day 460 | { 461 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 462 | return components.day; 463 | } 464 | 465 | - (NSInteger)month 466 | { 467 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 468 | return components.month; 469 | } 470 | 471 | - (NSInteger)week 472 | { 473 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 474 | return components.weekOfYear; 475 | } 476 | 477 | - (NSInteger)weekday 478 | { 479 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 480 | return components.weekday; 481 | } 482 | 483 | - (NSInteger)nthWeekday // e.g. 2nd Tuesday of the month is 2 484 | { 485 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 486 | return components.weekdayOrdinal; 487 | } 488 | 489 | - (NSInteger)year 490 | { 491 | NSDateComponents *components = [[NSDate currentCalendar] components:componentFlags fromDate:self]; 492 | return components.year; 493 | } 494 | 495 | @end 496 | -------------------------------------------------------------------------------- /Pods/PureLayout/PureLayout/PureLayout/NSArray+PureLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+PureLayout.m 3 | // v2.0.5 4 | // https://github.com/smileyborg/PureLayout 5 | // 6 | // Copyright (c) 2012 Richard Turton 7 | // Copyright (c) 2013-2015 Tyler Fox 8 | // 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy 12 | // of this software and associated documentation files (the "Software"), to 13 | // deal in the Software without restriction, including without limitation the 14 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 15 | // sell copies of the Software, and to permit persons to whom the Software is 16 | // furnished to do so, subject to the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be included in 19 | // all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 27 | // IN THE SOFTWARE. 28 | // 29 | 30 | #import "NSArray+PureLayout.h" 31 | #import "ALView+PureLayout.h" 32 | #import "NSLayoutConstraint+PureLayout.h" 33 | #import "PureLayout+Internal.h" 34 | 35 | 36 | #pragma mark - NSArray+PureLayout 37 | 38 | @implementation NSArray (PureLayout) 39 | 40 | 41 | #pragma mark Array of Constraints 42 | 43 | /** 44 | Activates the constraints in this array. 45 | */ 46 | - (void)autoInstallConstraints 47 | { 48 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 49 | if ([NSLayoutConstraint respondsToSelector:@selector(activateConstraints:)]) { 50 | for (id object in self) { 51 | if ([object isKindOfClass:[NSLayoutConstraint class]]) { 52 | [ALView al_applyGlobalStateToConstraint:object]; 53 | } 54 | } 55 | if ([ALView al_preventAutomaticConstraintInstallation]) { 56 | [[ALView al_currentArrayOfCreatedConstraints] addObjectsFromArray:self]; 57 | } else { 58 | [NSLayoutConstraint activateConstraints:self]; 59 | } 60 | return; 61 | } 62 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 63 | 64 | for (id object in self) { 65 | if ([object isKindOfClass:[NSLayoutConstraint class]]) { 66 | [((NSLayoutConstraint *)object) autoInstall]; 67 | } 68 | } 69 | } 70 | 71 | /** 72 | Deactivates the constraints in this array. 73 | */ 74 | - (void)autoRemoveConstraints 75 | { 76 | #if __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 77 | if ([NSLayoutConstraint respondsToSelector:@selector(deactivateConstraints:)]) { 78 | [NSLayoutConstraint deactivateConstraints:self]; 79 | return; 80 | } 81 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 || __PureLayout_MinBaseSDK_OSX_10_10 */ 82 | 83 | for (id object in self) { 84 | if ([object isKindOfClass:[NSLayoutConstraint class]]) { 85 | [((NSLayoutConstraint *)object) autoRemove]; 86 | } 87 | } 88 | } 89 | 90 | #if __PureLayout_MinBaseSDK_iOS_8_0 91 | 92 | /** 93 | Sets the string as the identifier for the constraints in this array. Available in iOS 7.0 and OS X 10.9 and later. 94 | The identifier will be printed along with each constraint's description. 95 | This is helpful to document the constraints' purpose and aid in debugging. 96 | 97 | @param identifier A string used to identify the constraints in this array. 98 | @return This array. 99 | */ 100 | - (instancetype)autoIdentifyConstraints:(NSString *)identifier 101 | { 102 | for (id object in self) { 103 | if ([object isKindOfClass:[NSLayoutConstraint class]]) { 104 | [((NSLayoutConstraint *)object) autoIdentify:identifier]; 105 | } 106 | } 107 | return self; 108 | } 109 | 110 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 111 | 112 | 113 | #pragma mark Array of Views 114 | 115 | /** 116 | Aligns views in this array to one another along a given edge. 117 | Note: This array must contain at least 2 views, and all views must share a common superview. 118 | 119 | @param edge The edge to which the views will be aligned. 120 | @return An array of constraints added. 121 | */ 122 | - (NSArray *)autoAlignViewsToEdge:(ALEdge)edge 123 | { 124 | NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views."); 125 | NSMutableArray *constraints = [NSMutableArray new]; 126 | ALView *previousView = nil; 127 | for (id object in self) { 128 | if ([object isKindOfClass:[ALView class]]) { 129 | ALView *view = (ALView *)object; 130 | view.translatesAutoresizingMaskIntoConstraints = NO; 131 | if (previousView) { 132 | [constraints addObject:[view autoPinEdge:edge toEdge:edge ofView:previousView]]; 133 | } 134 | previousView = view; 135 | } 136 | } 137 | return constraints; 138 | } 139 | 140 | /** 141 | Aligns views in this array to one another along a given axis. 142 | Note: This array must contain at least 2 views, and all views must share a common superview. 143 | 144 | @param axis The axis to which the views will be aligned. 145 | @return An array of constraints added. 146 | */ 147 | - (NSArray *)autoAlignViewsToAxis:(ALAxis)axis 148 | { 149 | NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views."); 150 | NSMutableArray *constraints = [NSMutableArray new]; 151 | ALView *previousView = nil; 152 | for (id object in self) { 153 | if ([object isKindOfClass:[ALView class]]) { 154 | ALView *view = (ALView *)object; 155 | view.translatesAutoresizingMaskIntoConstraints = NO; 156 | if (previousView) { 157 | [constraints addObject:[view autoAlignAxis:axis toSameAxisOfView:previousView]]; 158 | } 159 | previousView = view; 160 | } 161 | } 162 | return constraints; 163 | } 164 | 165 | /** 166 | Matches a given dimension of all the views in this array. 167 | Note: This array must contain at least 2 views, and all views must share a common superview. 168 | 169 | @param dimension The dimension to match for all of the views. 170 | @return An array of constraints added. 171 | */ 172 | - (NSArray *)autoMatchViewsDimension:(ALDimension)dimension 173 | { 174 | NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views."); 175 | NSMutableArray *constraints = [NSMutableArray new]; 176 | ALView *previousView = nil; 177 | for (id object in self) { 178 | if ([object isKindOfClass:[ALView class]]) { 179 | ALView *view = (ALView *)object; 180 | view.translatesAutoresizingMaskIntoConstraints = NO; 181 | if (previousView) { 182 | [constraints addObject:[view autoMatchDimension:dimension toDimension:dimension ofView:previousView]]; 183 | } 184 | previousView = view; 185 | } 186 | } 187 | return constraints; 188 | } 189 | 190 | /** 191 | Sets the given dimension of all the views in this array to a given size. 192 | Note: This array must contain at least 1 view. 193 | 194 | @param dimension The dimension of each of the views to set. 195 | @param size The size to set the given dimension of each view to. 196 | @return An array of constraints added. 197 | */ 198 | - (NSArray *)autoSetViewsDimension:(ALDimension)dimension toSize:(CGFloat)size 199 | { 200 | NSAssert([self al_containsMinimumNumberOfViews:1], @"This array must contain at least 1 view."); 201 | NSMutableArray *constraints = [NSMutableArray new]; 202 | for (id object in self) { 203 | if ([object isKindOfClass:[ALView class]]) { 204 | ALView *view = (ALView *)object; 205 | view.translatesAutoresizingMaskIntoConstraints = NO; 206 | [constraints addObject:[view autoSetDimension:dimension toSize:size]]; 207 | } 208 | } 209 | return constraints; 210 | } 211 | 212 | /** 213 | Sets all of the views in this array to a given size. 214 | Note: This array must contain at least 1 view. 215 | 216 | @param size The size to set each view's dimensions to. 217 | @return An array of constraints added. 218 | */ 219 | - (NSArray *)autoSetViewsDimensionsToSize:(CGSize)size 220 | { 221 | NSMutableArray *constraints = [NSMutableArray new]; 222 | [constraints addObjectsFromArray:[self autoSetViewsDimension:ALDimensionWidth toSize:size.width]]; 223 | [constraints addObjectsFromArray:[self autoSetViewsDimension:ALDimensionHeight toSize:size.height]]; 224 | return constraints; 225 | } 226 | 227 | 228 | /** 229 | Distributes the views in this array equally along the selected axis in their superview. 230 | Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them, 231 | including from the first and last views to their superview. 232 | 233 | @param axis The axis along which to distribute the views. 234 | @param alignment The attribute to use to align all the views to one another. 235 | @param spacing The fixed amount of spacing between each view. 236 | @return An array of constraints added. 237 | */ 238 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis 239 | alignedTo:(ALAttribute)alignment 240 | withFixedSpacing:(CGFloat)spacing 241 | { 242 | return [self autoDistributeViewsAlongAxis:axis 243 | alignedTo:alignment 244 | withFixedSpacing:spacing 245 | insetSpacing:YES]; 246 | } 247 | 248 | /** 249 | Distributes the views in this array equally along the selected axis in their superview. 250 | Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them. 251 | The first and last views can optionally be inset from their superview by the same amount of spacing as between views. 252 | 253 | @param axis The axis along which to distribute the views. 254 | @param alignment The attribute to use to align all the views to one another. 255 | @param spacing The fixed amount of spacing between each view. 256 | @param shouldSpaceInsets Whether the first and last views should be equally inset from their superview. 257 | @return An array of constraints added. 258 | */ 259 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis 260 | alignedTo:(ALAttribute)alignment 261 | withFixedSpacing:(CGFloat)spacing 262 | insetSpacing:(BOOL)shouldSpaceInsets 263 | { 264 | return [self autoDistributeViewsAlongAxis:axis 265 | alignedTo:alignment 266 | withFixedSpacing:spacing 267 | insetSpacing:shouldSpaceInsets 268 | matchedSizes:YES]; 269 | } 270 | 271 | /** 272 | Distributes the views in this array equally along the selected axis in their superview. 273 | Views will have fixed spacing between them, and can optionally be constrained to the same size in the dimension along the axis. 274 | The first and last views can optionally be inset from their superview by the same amount of spacing as between views. 275 | 276 | @param axis The axis along which to distribute the views. 277 | @param alignment The attribute to use to align all the views to one another. 278 | @param spacing The fixed amount of spacing between each view. 279 | @param shouldSpaceInsets Whether the first and last views should be equally inset from their superview. 280 | @param shouldMatchSizes Whether all views will be constrained to be the same size in the dimension along the axis. 281 | NOTE: All views must specify an intrinsic content size if passing NO, otherwise the layout will be ambiguous! 282 | @return An array of constraints added. 283 | */ 284 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis 285 | alignedTo:(ALAttribute)alignment 286 | withFixedSpacing:(CGFloat)spacing 287 | insetSpacing:(BOOL)shouldSpaceInsets 288 | matchedSizes:(BOOL)shouldMatchSizes 289 | { 290 | NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views to distribute."); 291 | ALDimension matchedDimension; 292 | ALEdge firstEdge, lastEdge; 293 | switch (axis) { 294 | case ALAxisHorizontal: 295 | case ALAxisBaseline: // same value as ALAxisLastBaseline 296 | #if __PureLayout_MinBaseSDK_iOS_8_0 297 | case ALAxisFirstBaseline: 298 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 299 | matchedDimension = ALDimensionWidth; 300 | firstEdge = ALEdgeLeading; 301 | lastEdge = ALEdgeTrailing; 302 | break; 303 | case ALAxisVertical: 304 | matchedDimension = ALDimensionHeight; 305 | firstEdge = ALEdgeTop; 306 | lastEdge = ALEdgeBottom; 307 | break; 308 | default: 309 | NSAssert(nil, @"Not a valid ALAxis."); 310 | return nil; 311 | } 312 | CGFloat leadingSpacing = shouldSpaceInsets ? spacing : 0.0; 313 | CGFloat trailingSpacing = shouldSpaceInsets ? spacing : 0.0; 314 | 315 | NSMutableArray *constraints = [NSMutableArray new]; 316 | ALView *previousView = nil; 317 | for (id object in self) { 318 | if ([object isKindOfClass:[ALView class]]) { 319 | ALView *view = (ALView *)object; 320 | view.translatesAutoresizingMaskIntoConstraints = NO; 321 | if (previousView) { 322 | // Second, Third, ... View 323 | [constraints addObject:[view autoPinEdge:firstEdge toEdge:lastEdge ofView:previousView withOffset:spacing]]; 324 | if (shouldMatchSizes) { 325 | [constraints addObject:[view autoMatchDimension:matchedDimension toDimension:matchedDimension ofView:previousView]]; 326 | } 327 | [constraints addObject:[view al_alignAttribute:alignment toView:previousView forAxis:axis]]; 328 | } 329 | else { 330 | // First view 331 | [constraints addObject:[view autoPinEdgeToSuperviewEdge:firstEdge withInset:leadingSpacing]]; 332 | } 333 | previousView = view; 334 | } 335 | } 336 | if (previousView) { 337 | // Last View 338 | [constraints addObject:[previousView autoPinEdgeToSuperviewEdge:lastEdge withInset:trailingSpacing]]; 339 | } 340 | return constraints; 341 | } 342 | 343 | /** 344 | Distributes the views in this array equally along the selected axis in their superview. 345 | Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them, 346 | including from the first and last views to their superview. 347 | 348 | @param axis The axis along which to distribute the views. 349 | @param alignment The attribute to use to align all the views to one another. 350 | @param size The fixed size of each view in the dimension along the given axis. 351 | @return An array of constraints added. 352 | */ 353 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis 354 | alignedTo:(ALAttribute)alignment 355 | withFixedSize:(CGFloat)size 356 | { 357 | return [self autoDistributeViewsAlongAxis:axis 358 | alignedTo:alignment 359 | withFixedSize:size 360 | insetSpacing:YES]; 361 | } 362 | 363 | /** 364 | Distributes the views in this array equally along the selected axis in their superview. 365 | Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them. 366 | The first and last views can optionally be inset from their superview by the same amount of spacing as between views. 367 | 368 | @param axis The axis along which to distribute the views. 369 | @param alignment The attribute to use to align all the views to one another. 370 | @param size The fixed size of each view in the dimension along the given axis. 371 | @param shouldSpaceInsets Whether the first and last views should be equally inset from their superview. 372 | @return An array of constraints added. 373 | */ 374 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis 375 | alignedTo:(ALAttribute)alignment 376 | withFixedSize:(CGFloat)size 377 | insetSpacing:(BOOL)shouldSpaceInsets 378 | { 379 | NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views to distribute."); 380 | ALDimension fixedDimension; 381 | NSLayoutAttribute attribute; 382 | switch (axis) { 383 | case ALAxisHorizontal: 384 | case ALAxisBaseline: // same value as ALAxisLastBaseline 385 | #if __PureLayout_MinBaseSDK_iOS_8_0 386 | case ALAxisFirstBaseline: 387 | #endif /* __PureLayout_MinBaseSDK_iOS_8_0 */ 388 | fixedDimension = ALDimensionWidth; 389 | attribute = NSLayoutAttributeCenterX; 390 | break; 391 | case ALAxisVertical: 392 | fixedDimension = ALDimensionHeight; 393 | attribute = NSLayoutAttributeCenterY; 394 | break; 395 | default: 396 | NSAssert(nil, @"Not a valid ALAxis."); 397 | return nil; 398 | } 399 | #if TARGET_OS_IPHONE 400 | # if !defined(PURELAYOUT_APP_EXTENSIONS) 401 | BOOL isRightToLeftLayout = [[UIApplication sharedApplication] userInterfaceLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft; 402 | # else 403 | // App Extensions may not access -[UIApplication sharedApplication]; fall back to checking the bundle's preferred localization character direction 404 | BOOL isRightToLeftLayout = [NSLocale characterDirectionForLanguage:[[NSBundle mainBundle] preferredLocalizations][0]] == NSLocaleLanguageDirectionRightToLeft; 405 | # endif /* !defined(PURELAYOUT_APP_EXTENSIONS) */ 406 | #else 407 | BOOL isRightToLeftLayout = [[NSApplication sharedApplication] userInterfaceLayoutDirection] == NSUserInterfaceLayoutDirectionRightToLeft; 408 | #endif /* TARGET_OS_IPHONE */ 409 | BOOL shouldFlipOrder = isRightToLeftLayout && (axis != ALAxisVertical); // imitate the effect of leading/trailing when distributing horizontally 410 | 411 | NSMutableArray *constraints = [NSMutableArray new]; 412 | NSArray *views = [self al_copyViewsOnly]; 413 | NSUInteger numberOfViews = [views count]; 414 | ALView *commonSuperview = [views al_commonSuperviewOfViews]; 415 | ALView *previousView = nil; 416 | for (NSUInteger i = 0; i < numberOfViews; i++) { 417 | ALView *view = shouldFlipOrder ? views[numberOfViews - i - 1] : views[i]; 418 | view.translatesAutoresizingMaskIntoConstraints = NO; 419 | [constraints addObject:[view autoSetDimension:fixedDimension toSize:size]]; 420 | CGFloat multiplier, constant; 421 | if (shouldSpaceInsets) { 422 | multiplier = (i * 2.0 + 2.0) / (numberOfViews + 1.0); 423 | constant = (multiplier - 1.0) * size / 2.0; 424 | } else { 425 | multiplier = (i * 2.0) / (numberOfViews - 1.0); 426 | constant = (-multiplier + 1.0) * size / 2.0; 427 | } 428 | // If the multiplier is very close to 0, set it to the minimum value to prevent the second item in the constraint from being lost. Filed as rdar://19168380 429 | if (fabs(multiplier) < kMULTIPLIER_MIN_VALUE) { 430 | multiplier = kMULTIPLIER_MIN_VALUE; 431 | } 432 | NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:view attribute:attribute relatedBy:NSLayoutRelationEqual toItem:commonSuperview attribute:attribute multiplier:multiplier constant:constant]; 433 | [constraint autoInstall]; 434 | [constraints addObject:constraint]; 435 | if (previousView) { 436 | [constraints addObject:[view al_alignAttribute:alignment toView:previousView forAxis:axis]]; 437 | } 438 | previousView = view; 439 | } 440 | return constraints; 441 | } 442 | 443 | #pragma mark Internal Helper Methods 444 | 445 | /** 446 | Returns the common superview for the views in this array. 447 | Raises an exception if the views in this array do not share a common superview. 448 | 449 | @return The common superview for the views in this array. 450 | */ 451 | - (ALView *)al_commonSuperviewOfViews 452 | { 453 | ALView *commonSuperview = nil; 454 | ALView *previousView = nil; 455 | for (id object in self) { 456 | if ([object isKindOfClass:[ALView class]]) { 457 | ALView *view = (ALView *)object; 458 | if (previousView) { 459 | commonSuperview = [view al_commonSuperviewWithView:commonSuperview]; 460 | } else { 461 | commonSuperview = view; 462 | } 463 | previousView = view; 464 | } 465 | } 466 | NSAssert(commonSuperview, @"Can't constrain views that do not share a common superview. Make sure that all the views in this array have been added into the same view hierarchy."); 467 | return commonSuperview; 468 | } 469 | 470 | /** 471 | Determines whether this array contains a minimum number of views. 472 | 473 | @param minimumNumberOfViews The minimum number of views to check for. 474 | @return YES if this array contains at least the minimum number of views, NO otherwise. 475 | */ 476 | - (BOOL)al_containsMinimumNumberOfViews:(NSUInteger)minimumNumberOfViews 477 | { 478 | NSUInteger numberOfViews = 0; 479 | for (id object in self) { 480 | if ([object isKindOfClass:[ALView class]]) { 481 | numberOfViews++; 482 | if (numberOfViews >= minimumNumberOfViews) { 483 | return YES; 484 | } 485 | } 486 | } 487 | return numberOfViews >= minimumNumberOfViews; 488 | } 489 | 490 | /** 491 | Creates a copy of this array containing only the view objects in it. 492 | 493 | @return A new array containing only the views that are in this array. 494 | */ 495 | - (NSArray *)al_copyViewsOnly 496 | { 497 | NSMutableArray *viewsOnlyArray = [NSMutableArray arrayWithCapacity:[self count]]; 498 | for (id object in self) { 499 | if ([object isKindOfClass:[ALView class]]) { 500 | [viewsOnlyArray addObject:object]; 501 | } 502 | } 503 | return viewsOnlyArray; 504 | } 505 | 506 | @end 507 | -------------------------------------------------------------------------------- /EFCalendarGraph.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 73B7D3211B4B71570081BDF1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 73B7D3201B4B71570081BDF1 /* main.m */; }; 11 | 73B7D3241B4B71570081BDF1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 73B7D3231B4B71570081BDF1 /* AppDelegate.m */; }; 12 | 73B7D3271B4B71570081BDF1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 73B7D3261B4B71570081BDF1 /* ViewController.m */; }; 13 | 73B7D32A1B4B71570081BDF1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 73B7D3281B4B71570081BDF1 /* Main.storyboard */; }; 14 | 73B7D32C1B4B71570081BDF1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 73B7D32B1B4B71570081BDF1 /* Images.xcassets */; }; 15 | 73B7D32F1B4B71570081BDF1 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 73B7D32D1B4B71570081BDF1 /* LaunchScreen.xib */; }; 16 | 73B7D33B1B4B71570081BDF1 /* EFCalendarGraphTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 73B7D33A1B4B71570081BDF1 /* EFCalendarGraphTests.m */; }; 17 | 73B7D3461B4B71680081BDF1 /* EFCalendarGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = 73B7D3451B4B71680081BDF1 /* EFCalendarGraph.m */; }; 18 | 73B7D3491B4CBB540081BDF1 /* NSDate+Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 73B7D3481B4CBB540081BDF1 /* NSDate+Utilities.m */; }; 19 | DEC118E79C529D7814961164 /* Pods_EFCalendarGraph.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB1EEC452CA5AB51BE05D057 /* Pods_EFCalendarGraph.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 73B7D3351B4B71570081BDF1 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 73B7D3131B4B71570081BDF1 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 73B7D31A1B4B71570081BDF1; 28 | remoteInfo = EFCalendarGraph; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 73B7D31B1B4B71570081BDF1 /* EFCalendarGraph.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EFCalendarGraph.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 73B7D31F1B4B71570081BDF1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 73B7D3201B4B71570081BDF1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | 73B7D3221B4B71570081BDF1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | 73B7D3231B4B71570081BDF1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | 73B7D3251B4B71570081BDF1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | 73B7D3261B4B71570081BDF1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | 73B7D3291B4B71570081BDF1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | 73B7D32B1B4B71570081BDF1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | 73B7D32E1B4B71570081BDF1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | 73B7D3341B4B71570081BDF1 /* EFCalendarGraphTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EFCalendarGraphTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 73B7D3391B4B71570081BDF1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 73B7D33A1B4B71570081BDF1 /* EFCalendarGraphTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EFCalendarGraphTests.m; sourceTree = ""; }; 46 | 73B7D3441B4B71680081BDF1 /* EFCalendarGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EFCalendarGraph.h; sourceTree = ""; }; 47 | 73B7D3451B4B71680081BDF1 /* EFCalendarGraph.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EFCalendarGraph.m; sourceTree = ""; }; 48 | 73B7D3471B4CBB540081BDF1 /* NSDate+Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+Utilities.h"; sourceTree = ""; }; 49 | 73B7D3481B4CBB540081BDF1 /* NSDate+Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+Utilities.m"; sourceTree = ""; }; 50 | 7BEC80CF76536A64741D24AC /* Pods-EFCalendarGraph.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EFCalendarGraph.release.xcconfig"; path = "Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph.release.xcconfig"; sourceTree = ""; }; 51 | AB1EEC452CA5AB51BE05D057 /* Pods_EFCalendarGraph.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_EFCalendarGraph.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | D05090B13517157AB1746678 /* Pods-EFCalendarGraph.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EFCalendarGraph.debug.xcconfig"; path = "Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph.debug.xcconfig"; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 73B7D3181B4B71570081BDF1 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | DEC118E79C529D7814961164 /* Pods_EFCalendarGraph.framework in Frameworks */, 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | 73B7D3311B4B71570081BDF1 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXFrameworksBuildPhase section */ 72 | 73 | /* Begin PBXGroup section */ 74 | 73B7D3121B4B71570081BDF1 = { 75 | isa = PBXGroup; 76 | children = ( 77 | 73B7D31D1B4B71570081BDF1 /* EFCalendarGraph */, 78 | 73B7D3371B4B71570081BDF1 /* EFCalendarGraphTests */, 79 | 73B7D31C1B4B71570081BDF1 /* Products */, 80 | EB32611F96A39683EEA7AD23 /* Pods */, 81 | D65F9E168F3FA73E5E61152A /* Frameworks */, 82 | ); 83 | sourceTree = ""; 84 | }; 85 | 73B7D31C1B4B71570081BDF1 /* Products */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 73B7D31B1B4B71570081BDF1 /* EFCalendarGraph.app */, 89 | 73B7D3341B4B71570081BDF1 /* EFCalendarGraphTests.xctest */, 90 | ); 91 | name = Products; 92 | sourceTree = ""; 93 | }; 94 | 73B7D31D1B4B71570081BDF1 /* EFCalendarGraph */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 73B7D3221B4B71570081BDF1 /* AppDelegate.h */, 98 | 73B7D3231B4B71570081BDF1 /* AppDelegate.m */, 99 | 73B7D3251B4B71570081BDF1 /* ViewController.h */, 100 | 73B7D3261B4B71570081BDF1 /* ViewController.m */, 101 | 73B7D3281B4B71570081BDF1 /* Main.storyboard */, 102 | 73B7D32B1B4B71570081BDF1 /* Images.xcassets */, 103 | 73B7D32D1B4B71570081BDF1 /* LaunchScreen.xib */, 104 | 73B7D31E1B4B71570081BDF1 /* Supporting Files */, 105 | 73B7D3441B4B71680081BDF1 /* EFCalendarGraph.h */, 106 | 73B7D3451B4B71680081BDF1 /* EFCalendarGraph.m */, 107 | 73B7D3471B4CBB540081BDF1 /* NSDate+Utilities.h */, 108 | 73B7D3481B4CBB540081BDF1 /* NSDate+Utilities.m */, 109 | ); 110 | path = EFCalendarGraph; 111 | sourceTree = ""; 112 | }; 113 | 73B7D31E1B4B71570081BDF1 /* Supporting Files */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 73B7D31F1B4B71570081BDF1 /* Info.plist */, 117 | 73B7D3201B4B71570081BDF1 /* main.m */, 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | 73B7D3371B4B71570081BDF1 /* EFCalendarGraphTests */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 73B7D33A1B4B71570081BDF1 /* EFCalendarGraphTests.m */, 126 | 73B7D3381B4B71570081BDF1 /* Supporting Files */, 127 | ); 128 | path = EFCalendarGraphTests; 129 | sourceTree = ""; 130 | }; 131 | 73B7D3381B4B71570081BDF1 /* Supporting Files */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 73B7D3391B4B71570081BDF1 /* Info.plist */, 135 | ); 136 | name = "Supporting Files"; 137 | sourceTree = ""; 138 | }; 139 | D65F9E168F3FA73E5E61152A /* Frameworks */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | AB1EEC452CA5AB51BE05D057 /* Pods_EFCalendarGraph.framework */, 143 | ); 144 | name = Frameworks; 145 | sourceTree = ""; 146 | }; 147 | EB32611F96A39683EEA7AD23 /* Pods */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | D05090B13517157AB1746678 /* Pods-EFCalendarGraph.debug.xcconfig */, 151 | 7BEC80CF76536A64741D24AC /* Pods-EFCalendarGraph.release.xcconfig */, 152 | ); 153 | name = Pods; 154 | sourceTree = ""; 155 | }; 156 | /* End PBXGroup section */ 157 | 158 | /* Begin PBXNativeTarget section */ 159 | 73B7D31A1B4B71570081BDF1 /* EFCalendarGraph */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = 73B7D33E1B4B71570081BDF1 /* Build configuration list for PBXNativeTarget "EFCalendarGraph" */; 162 | buildPhases = ( 163 | 48B0513262CA495D648E9270 /* Check Pods Manifest.lock */, 164 | 73B7D3171B4B71570081BDF1 /* Sources */, 165 | 73B7D3181B4B71570081BDF1 /* Frameworks */, 166 | 73B7D3191B4B71570081BDF1 /* Resources */, 167 | 4DE10EC2B5A2CE7FF8FA71BB /* Embed Pods Frameworks */, 168 | 57A8262D489BEF80229A825D /* Copy Pods Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | ); 174 | name = EFCalendarGraph; 175 | productName = EFCalendarGraph; 176 | productReference = 73B7D31B1B4B71570081BDF1 /* EFCalendarGraph.app */; 177 | productType = "com.apple.product-type.application"; 178 | }; 179 | 73B7D3331B4B71570081BDF1 /* EFCalendarGraphTests */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = 73B7D3411B4B71570081BDF1 /* Build configuration list for PBXNativeTarget "EFCalendarGraphTests" */; 182 | buildPhases = ( 183 | 73B7D3301B4B71570081BDF1 /* Sources */, 184 | 73B7D3311B4B71570081BDF1 /* Frameworks */, 185 | 73B7D3321B4B71570081BDF1 /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | 73B7D3361B4B71570081BDF1 /* PBXTargetDependency */, 191 | ); 192 | name = EFCalendarGraphTests; 193 | productName = EFCalendarGraphTests; 194 | productReference = 73B7D3341B4B71570081BDF1 /* EFCalendarGraphTests.xctest */; 195 | productType = "com.apple.product-type.bundle.unit-test"; 196 | }; 197 | /* End PBXNativeTarget section */ 198 | 199 | /* Begin PBXProject section */ 200 | 73B7D3131B4B71570081BDF1 /* Project object */ = { 201 | isa = PBXProject; 202 | attributes = { 203 | LastUpgradeCheck = 0640; 204 | TargetAttributes = { 205 | 73B7D31A1B4B71570081BDF1 = { 206 | CreatedOnToolsVersion = 6.4; 207 | }; 208 | 73B7D3331B4B71570081BDF1 = { 209 | CreatedOnToolsVersion = 6.4; 210 | TestTargetID = 73B7D31A1B4B71570081BDF1; 211 | }; 212 | }; 213 | }; 214 | buildConfigurationList = 73B7D3161B4B71570081BDF1 /* Build configuration list for PBXProject "EFCalendarGraph" */; 215 | compatibilityVersion = "Xcode 3.2"; 216 | developmentRegion = English; 217 | hasScannedForEncodings = 0; 218 | knownRegions = ( 219 | en, 220 | Base, 221 | ); 222 | mainGroup = 73B7D3121B4B71570081BDF1; 223 | productRefGroup = 73B7D31C1B4B71570081BDF1 /* Products */; 224 | projectDirPath = ""; 225 | projectRoot = ""; 226 | targets = ( 227 | 73B7D31A1B4B71570081BDF1 /* EFCalendarGraph */, 228 | 73B7D3331B4B71570081BDF1 /* EFCalendarGraphTests */, 229 | ); 230 | }; 231 | /* End PBXProject section */ 232 | 233 | /* Begin PBXResourcesBuildPhase section */ 234 | 73B7D3191B4B71570081BDF1 /* Resources */ = { 235 | isa = PBXResourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | 73B7D32A1B4B71570081BDF1 /* Main.storyboard in Resources */, 239 | 73B7D32F1B4B71570081BDF1 /* LaunchScreen.xib in Resources */, 240 | 73B7D32C1B4B71570081BDF1 /* Images.xcassets in Resources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | 73B7D3321B4B71570081BDF1 /* Resources */ = { 245 | isa = PBXResourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | }; 251 | /* End PBXResourcesBuildPhase section */ 252 | 253 | /* Begin PBXShellScriptBuildPhase section */ 254 | 48B0513262CA495D648E9270 /* Check Pods Manifest.lock */ = { 255 | isa = PBXShellScriptBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | ); 259 | inputPaths = ( 260 | ); 261 | name = "Check Pods Manifest.lock"; 262 | outputPaths = ( 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | shellPath = /bin/sh; 266 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 267 | showEnvVarsInLog = 0; 268 | }; 269 | 4DE10EC2B5A2CE7FF8FA71BB /* Embed Pods Frameworks */ = { 270 | isa = PBXShellScriptBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | ); 274 | inputPaths = ( 275 | ); 276 | name = "Embed Pods Frameworks"; 277 | outputPaths = ( 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | shellPath = /bin/sh; 281 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph-frameworks.sh\"\n"; 282 | showEnvVarsInLog = 0; 283 | }; 284 | 57A8262D489BEF80229A825D /* Copy Pods Resources */ = { 285 | isa = PBXShellScriptBuildPhase; 286 | buildActionMask = 2147483647; 287 | files = ( 288 | ); 289 | inputPaths = ( 290 | ); 291 | name = "Copy Pods Resources"; 292 | outputPaths = ( 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | shellPath = /bin/sh; 296 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-EFCalendarGraph/Pods-EFCalendarGraph-resources.sh\"\n"; 297 | showEnvVarsInLog = 0; 298 | }; 299 | /* End PBXShellScriptBuildPhase section */ 300 | 301 | /* Begin PBXSourcesBuildPhase section */ 302 | 73B7D3171B4B71570081BDF1 /* Sources */ = { 303 | isa = PBXSourcesBuildPhase; 304 | buildActionMask = 2147483647; 305 | files = ( 306 | 73B7D3271B4B71570081BDF1 /* ViewController.m in Sources */, 307 | 73B7D3241B4B71570081BDF1 /* AppDelegate.m in Sources */, 308 | 73B7D3211B4B71570081BDF1 /* main.m in Sources */, 309 | 73B7D3461B4B71680081BDF1 /* EFCalendarGraph.m in Sources */, 310 | 73B7D3491B4CBB540081BDF1 /* NSDate+Utilities.m in Sources */, 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | }; 314 | 73B7D3301B4B71570081BDF1 /* Sources */ = { 315 | isa = PBXSourcesBuildPhase; 316 | buildActionMask = 2147483647; 317 | files = ( 318 | 73B7D33B1B4B71570081BDF1 /* EFCalendarGraphTests.m in Sources */, 319 | ); 320 | runOnlyForDeploymentPostprocessing = 0; 321 | }; 322 | /* End PBXSourcesBuildPhase section */ 323 | 324 | /* Begin PBXTargetDependency section */ 325 | 73B7D3361B4B71570081BDF1 /* PBXTargetDependency */ = { 326 | isa = PBXTargetDependency; 327 | target = 73B7D31A1B4B71570081BDF1 /* EFCalendarGraph */; 328 | targetProxy = 73B7D3351B4B71570081BDF1 /* PBXContainerItemProxy */; 329 | }; 330 | /* End PBXTargetDependency section */ 331 | 332 | /* Begin PBXVariantGroup section */ 333 | 73B7D3281B4B71570081BDF1 /* Main.storyboard */ = { 334 | isa = PBXVariantGroup; 335 | children = ( 336 | 73B7D3291B4B71570081BDF1 /* Base */, 337 | ); 338 | name = Main.storyboard; 339 | sourceTree = ""; 340 | }; 341 | 73B7D32D1B4B71570081BDF1 /* LaunchScreen.xib */ = { 342 | isa = PBXVariantGroup; 343 | children = ( 344 | 73B7D32E1B4B71570081BDF1 /* Base */, 345 | ); 346 | name = LaunchScreen.xib; 347 | sourceTree = ""; 348 | }; 349 | /* End PBXVariantGroup section */ 350 | 351 | /* Begin XCBuildConfiguration section */ 352 | 73B7D33C1B4B71570081BDF1 /* Debug */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | ALWAYS_SEARCH_USER_PATHS = NO; 356 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 357 | CLANG_CXX_LIBRARY = "libc++"; 358 | CLANG_ENABLE_MODULES = YES; 359 | CLANG_ENABLE_OBJC_ARC = YES; 360 | CLANG_WARN_BOOL_CONVERSION = YES; 361 | CLANG_WARN_CONSTANT_CONVERSION = YES; 362 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 363 | CLANG_WARN_EMPTY_BODY = YES; 364 | CLANG_WARN_ENUM_CONVERSION = YES; 365 | CLANG_WARN_INT_CONVERSION = YES; 366 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 367 | CLANG_WARN_UNREACHABLE_CODE = YES; 368 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 369 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 370 | COPY_PHASE_STRIP = NO; 371 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 372 | ENABLE_STRICT_OBJC_MSGSEND = YES; 373 | GCC_C_LANGUAGE_STANDARD = gnu99; 374 | GCC_DYNAMIC_NO_PIC = NO; 375 | GCC_NO_COMMON_BLOCKS = YES; 376 | GCC_OPTIMIZATION_LEVEL = 0; 377 | GCC_PREPROCESSOR_DEFINITIONS = ( 378 | "DEBUG=1", 379 | "$(inherited)", 380 | ); 381 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 382 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 383 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 384 | GCC_WARN_UNDECLARED_SELECTOR = YES; 385 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 386 | GCC_WARN_UNUSED_FUNCTION = YES; 387 | GCC_WARN_UNUSED_VARIABLE = YES; 388 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 389 | MTL_ENABLE_DEBUG_INFO = YES; 390 | ONLY_ACTIVE_ARCH = YES; 391 | SDKROOT = iphoneos; 392 | TARGETED_DEVICE_FAMILY = "1,2"; 393 | }; 394 | name = Debug; 395 | }; 396 | 73B7D33D1B4B71570081BDF1 /* Release */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | ALWAYS_SEARCH_USER_PATHS = NO; 400 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 401 | CLANG_CXX_LIBRARY = "libc++"; 402 | CLANG_ENABLE_MODULES = YES; 403 | CLANG_ENABLE_OBJC_ARC = YES; 404 | CLANG_WARN_BOOL_CONVERSION = YES; 405 | CLANG_WARN_CONSTANT_CONVERSION = YES; 406 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 407 | CLANG_WARN_EMPTY_BODY = YES; 408 | CLANG_WARN_ENUM_CONVERSION = YES; 409 | CLANG_WARN_INT_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 414 | COPY_PHASE_STRIP = NO; 415 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 416 | ENABLE_NS_ASSERTIONS = NO; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_NO_COMMON_BLOCKS = YES; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 422 | GCC_WARN_UNDECLARED_SELECTOR = YES; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 427 | MTL_ENABLE_DEBUG_INFO = NO; 428 | SDKROOT = iphoneos; 429 | TARGETED_DEVICE_FAMILY = "1,2"; 430 | VALIDATE_PRODUCT = YES; 431 | }; 432 | name = Release; 433 | }; 434 | 73B7D33F1B4B71570081BDF1 /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = D05090B13517157AB1746678 /* Pods-EFCalendarGraph.debug.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | INFOPLIST_FILE = EFCalendarGraph/Info.plist; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 441 | PRODUCT_NAME = "$(TARGET_NAME)"; 442 | }; 443 | name = Debug; 444 | }; 445 | 73B7D3401B4B71570081BDF1 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | baseConfigurationReference = 7BEC80CF76536A64741D24AC /* Pods-EFCalendarGraph.release.xcconfig */; 448 | buildSettings = { 449 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 450 | INFOPLIST_FILE = EFCalendarGraph/Info.plist; 451 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | }; 454 | name = Release; 455 | }; 456 | 73B7D3421B4B71570081BDF1 /* Debug */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | BUNDLE_LOADER = "$(TEST_HOST)"; 460 | FRAMEWORK_SEARCH_PATHS = ( 461 | "$(SDKROOT)/Developer/Library/Frameworks", 462 | "$(inherited)", 463 | ); 464 | GCC_PREPROCESSOR_DEFINITIONS = ( 465 | "DEBUG=1", 466 | "$(inherited)", 467 | ); 468 | INFOPLIST_FILE = EFCalendarGraphTests/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 470 | PRODUCT_NAME = "$(TARGET_NAME)"; 471 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EFCalendarGraph.app/EFCalendarGraph"; 472 | }; 473 | name = Debug; 474 | }; 475 | 73B7D3431B4B71570081BDF1 /* Release */ = { 476 | isa = XCBuildConfiguration; 477 | buildSettings = { 478 | BUNDLE_LOADER = "$(TEST_HOST)"; 479 | FRAMEWORK_SEARCH_PATHS = ( 480 | "$(SDKROOT)/Developer/Library/Frameworks", 481 | "$(inherited)", 482 | ); 483 | INFOPLIST_FILE = EFCalendarGraphTests/Info.plist; 484 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EFCalendarGraph.app/EFCalendarGraph"; 487 | }; 488 | name = Release; 489 | }; 490 | /* End XCBuildConfiguration section */ 491 | 492 | /* Begin XCConfigurationList section */ 493 | 73B7D3161B4B71570081BDF1 /* Build configuration list for PBXProject "EFCalendarGraph" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 73B7D33C1B4B71570081BDF1 /* Debug */, 497 | 73B7D33D1B4B71570081BDF1 /* Release */, 498 | ); 499 | defaultConfigurationIsVisible = 0; 500 | defaultConfigurationName = Release; 501 | }; 502 | 73B7D33E1B4B71570081BDF1 /* Build configuration list for PBXNativeTarget "EFCalendarGraph" */ = { 503 | isa = XCConfigurationList; 504 | buildConfigurations = ( 505 | 73B7D33F1B4B71570081BDF1 /* Debug */, 506 | 73B7D3401B4B71570081BDF1 /* Release */, 507 | ); 508 | defaultConfigurationIsVisible = 0; 509 | defaultConfigurationName = Release; 510 | }; 511 | 73B7D3411B4B71570081BDF1 /* Build configuration list for PBXNativeTarget "EFCalendarGraphTests" */ = { 512 | isa = XCConfigurationList; 513 | buildConfigurations = ( 514 | 73B7D3421B4B71570081BDF1 /* Debug */, 515 | 73B7D3431B4B71570081BDF1 /* Release */, 516 | ); 517 | defaultConfigurationIsVisible = 0; 518 | defaultConfigurationName = Release; 519 | }; 520 | /* End XCConfigurationList section */ 521 | }; 522 | rootObject = 73B7D3131B4B71570081BDF1 /* Project object */; 523 | } 524 | --------------------------------------------------------------------------------