├── .gitignore ├── WeekCalendarDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── WeekCalendarDemo ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.swift ├── WeekView+Extentions.swift └── WeekView.swift ├── WeekCalendarDemoTests ├── Info.plist └── WeekCalendarDemoTests.swift └── WeekCalendarDemoUITests ├── Info.plist └── WeekCalendarDemoUITests.swift /.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 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | .build/ 41 | 42 | # CocoaPods 43 | # 44 | # We recommend against adding the Pods directory to your .gitignore. However 45 | # you should judge for yourself, the pros and cons are mentioned at: 46 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 47 | # 48 | # Pods/ 49 | 50 | # Carthage 51 | # 52 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 53 | # Carthage/Checkouts 54 | 55 | Carthage/Build 56 | 57 | # fastlane 58 | # 59 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 60 | # screenshots whenever they are needed. 61 | # For more information about the recommended setup visit: 62 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 63 | 64 | fastlane/report.xml 65 | fastlane/Preview.html 66 | fastlane/screenshots 67 | fastlane/test_output 68 | -------------------------------------------------------------------------------- /WeekCalendarDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 92537B051ED57AE600A9F695 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92537B041ED57AE600A9F695 /* AppDelegate.swift */; }; 11 | 92537B071ED57AE600A9F695 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92537B061ED57AE600A9F695 /* ViewController.swift */; }; 12 | 92537B0A1ED57AE600A9F695 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 92537B081ED57AE600A9F695 /* Main.storyboard */; }; 13 | 92537B0C1ED57AE700A9F695 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92537B0B1ED57AE700A9F695 /* Assets.xcassets */; }; 14 | 92537B0F1ED57AE700A9F695 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 92537B0D1ED57AE700A9F695 /* LaunchScreen.storyboard */; }; 15 | 92537B1A1ED57AE800A9F695 /* WeekCalendarDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92537B191ED57AE800A9F695 /* WeekCalendarDemoTests.swift */; }; 16 | 92537B251ED57AE800A9F695 /* WeekCalendarDemoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92537B241ED57AE800A9F695 /* WeekCalendarDemoUITests.swift */; }; 17 | 92537B331ED57BE100A9F695 /* WeekView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92537B321ED57BE100A9F695 /* WeekView.swift */; }; 18 | 92537B351ED58B9900A9F695 /* WeekView+Extentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92537B341ED58B9900A9F695 /* WeekView+Extentions.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 92537B161ED57AE800A9F695 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 92537AF91ED57AE600A9F695 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 92537B001ED57AE600A9F695; 27 | remoteInfo = WeekCalendarDemo; 28 | }; 29 | 92537B211ED57AE800A9F695 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 92537AF91ED57AE600A9F695 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 92537B001ED57AE600A9F695; 34 | remoteInfo = WeekCalendarDemo; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 92537B011ED57AE600A9F695 /* WeekCalendarDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WeekCalendarDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 92537B041ED57AE600A9F695 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 41 | 92537B061ED57AE600A9F695 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 42 | 92537B091ED57AE600A9F695 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | 92537B0B1ED57AE700A9F695 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 44 | 92537B0E1ED57AE700A9F695 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 45 | 92537B101ED57AE700A9F695 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | 92537B151ED57AE800A9F695 /* WeekCalendarDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WeekCalendarDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 92537B191ED57AE800A9F695 /* WeekCalendarDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeekCalendarDemoTests.swift; sourceTree = ""; }; 48 | 92537B1B1ED57AE800A9F695 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | 92537B201ED57AE800A9F695 /* WeekCalendarDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WeekCalendarDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 92537B241ED57AE800A9F695 /* WeekCalendarDemoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeekCalendarDemoUITests.swift; sourceTree = ""; }; 51 | 92537B261ED57AE800A9F695 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 92537B321ED57BE100A9F695 /* WeekView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeekView.swift; sourceTree = ""; }; 53 | 92537B341ED58B9900A9F695 /* WeekView+Extentions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WeekView+Extentions.swift"; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 92537AFE1ED57AE600A9F695 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | 92537B121ED57AE800A9F695 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | 92537B1D1ED57AE800A9F695 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | 92537AF81ED57AE600A9F695 = { 82 | isa = PBXGroup; 83 | children = ( 84 | 92537B031ED57AE600A9F695 /* WeekCalendarDemo */, 85 | 92537B181ED57AE800A9F695 /* WeekCalendarDemoTests */, 86 | 92537B231ED57AE800A9F695 /* WeekCalendarDemoUITests */, 87 | 92537B021ED57AE600A9F695 /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 92537B021ED57AE600A9F695 /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 92537B011ED57AE600A9F695 /* WeekCalendarDemo.app */, 95 | 92537B151ED57AE800A9F695 /* WeekCalendarDemoTests.xctest */, 96 | 92537B201ED57AE800A9F695 /* WeekCalendarDemoUITests.xctest */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | 92537B031ED57AE600A9F695 /* WeekCalendarDemo */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 92537B041ED57AE600A9F695 /* AppDelegate.swift */, 105 | 92537B061ED57AE600A9F695 /* ViewController.swift */, 106 | 92537B321ED57BE100A9F695 /* WeekView.swift */, 107 | 92537B341ED58B9900A9F695 /* WeekView+Extentions.swift */, 108 | 92537B081ED57AE600A9F695 /* Main.storyboard */, 109 | 92537B0B1ED57AE700A9F695 /* Assets.xcassets */, 110 | 92537B0D1ED57AE700A9F695 /* LaunchScreen.storyboard */, 111 | 92537B101ED57AE700A9F695 /* Info.plist */, 112 | ); 113 | path = WeekCalendarDemo; 114 | sourceTree = ""; 115 | }; 116 | 92537B181ED57AE800A9F695 /* WeekCalendarDemoTests */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 92537B191ED57AE800A9F695 /* WeekCalendarDemoTests.swift */, 120 | 92537B1B1ED57AE800A9F695 /* Info.plist */, 121 | ); 122 | path = WeekCalendarDemoTests; 123 | sourceTree = ""; 124 | }; 125 | 92537B231ED57AE800A9F695 /* WeekCalendarDemoUITests */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 92537B241ED57AE800A9F695 /* WeekCalendarDemoUITests.swift */, 129 | 92537B261ED57AE800A9F695 /* Info.plist */, 130 | ); 131 | path = WeekCalendarDemoUITests; 132 | sourceTree = ""; 133 | }; 134 | /* End PBXGroup section */ 135 | 136 | /* Begin PBXNativeTarget section */ 137 | 92537B001ED57AE600A9F695 /* WeekCalendarDemo */ = { 138 | isa = PBXNativeTarget; 139 | buildConfigurationList = 92537B291ED57AE800A9F695 /* Build configuration list for PBXNativeTarget "WeekCalendarDemo" */; 140 | buildPhases = ( 141 | 92537AFD1ED57AE600A9F695 /* Sources */, 142 | 92537AFE1ED57AE600A9F695 /* Frameworks */, 143 | 92537AFF1ED57AE600A9F695 /* Resources */, 144 | ); 145 | buildRules = ( 146 | ); 147 | dependencies = ( 148 | ); 149 | name = WeekCalendarDemo; 150 | productName = WeekCalendarDemo; 151 | productReference = 92537B011ED57AE600A9F695 /* WeekCalendarDemo.app */; 152 | productType = "com.apple.product-type.application"; 153 | }; 154 | 92537B141ED57AE800A9F695 /* WeekCalendarDemoTests */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = 92537B2C1ED57AE800A9F695 /* Build configuration list for PBXNativeTarget "WeekCalendarDemoTests" */; 157 | buildPhases = ( 158 | 92537B111ED57AE800A9F695 /* Sources */, 159 | 92537B121ED57AE800A9F695 /* Frameworks */, 160 | 92537B131ED57AE800A9F695 /* Resources */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | 92537B171ED57AE800A9F695 /* PBXTargetDependency */, 166 | ); 167 | name = WeekCalendarDemoTests; 168 | productName = WeekCalendarDemoTests; 169 | productReference = 92537B151ED57AE800A9F695 /* WeekCalendarDemoTests.xctest */; 170 | productType = "com.apple.product-type.bundle.unit-test"; 171 | }; 172 | 92537B1F1ED57AE800A9F695 /* WeekCalendarDemoUITests */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = 92537B2F1ED57AE800A9F695 /* Build configuration list for PBXNativeTarget "WeekCalendarDemoUITests" */; 175 | buildPhases = ( 176 | 92537B1C1ED57AE800A9F695 /* Sources */, 177 | 92537B1D1ED57AE800A9F695 /* Frameworks */, 178 | 92537B1E1ED57AE800A9F695 /* Resources */, 179 | ); 180 | buildRules = ( 181 | ); 182 | dependencies = ( 183 | 92537B221ED57AE800A9F695 /* PBXTargetDependency */, 184 | ); 185 | name = WeekCalendarDemoUITests; 186 | productName = WeekCalendarDemoUITests; 187 | productReference = 92537B201ED57AE800A9F695 /* WeekCalendarDemoUITests.xctest */; 188 | productType = "com.apple.product-type.bundle.ui-testing"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | 92537AF91ED57AE600A9F695 /* Project object */ = { 194 | isa = PBXProject; 195 | attributes = { 196 | LastSwiftUpdateCheck = 0830; 197 | LastUpgradeCheck = 0830; 198 | ORGANIZATIONNAME = Ducere; 199 | TargetAttributes = { 200 | 92537B001ED57AE600A9F695 = { 201 | CreatedOnToolsVersion = 8.3.2; 202 | DevelopmentTeam = 7A6UCRCPF9; 203 | ProvisioningStyle = Automatic; 204 | }; 205 | 92537B141ED57AE800A9F695 = { 206 | CreatedOnToolsVersion = 8.3.2; 207 | DevelopmentTeam = 7A6UCRCPF9; 208 | ProvisioningStyle = Automatic; 209 | TestTargetID = 92537B001ED57AE600A9F695; 210 | }; 211 | 92537B1F1ED57AE800A9F695 = { 212 | CreatedOnToolsVersion = 8.3.2; 213 | DevelopmentTeam = 7A6UCRCPF9; 214 | ProvisioningStyle = Automatic; 215 | TestTargetID = 92537B001ED57AE600A9F695; 216 | }; 217 | }; 218 | }; 219 | buildConfigurationList = 92537AFC1ED57AE600A9F695 /* Build configuration list for PBXProject "WeekCalendarDemo" */; 220 | compatibilityVersion = "Xcode 3.2"; 221 | developmentRegion = English; 222 | hasScannedForEncodings = 0; 223 | knownRegions = ( 224 | en, 225 | Base, 226 | ); 227 | mainGroup = 92537AF81ED57AE600A9F695; 228 | productRefGroup = 92537B021ED57AE600A9F695 /* Products */; 229 | projectDirPath = ""; 230 | projectRoot = ""; 231 | targets = ( 232 | 92537B001ED57AE600A9F695 /* WeekCalendarDemo */, 233 | 92537B141ED57AE800A9F695 /* WeekCalendarDemoTests */, 234 | 92537B1F1ED57AE800A9F695 /* WeekCalendarDemoUITests */, 235 | ); 236 | }; 237 | /* End PBXProject section */ 238 | 239 | /* Begin PBXResourcesBuildPhase section */ 240 | 92537AFF1ED57AE600A9F695 /* Resources */ = { 241 | isa = PBXResourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | 92537B0F1ED57AE700A9F695 /* LaunchScreen.storyboard in Resources */, 245 | 92537B0C1ED57AE700A9F695 /* Assets.xcassets in Resources */, 246 | 92537B0A1ED57AE600A9F695 /* Main.storyboard in Resources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | 92537B131ED57AE800A9F695 /* Resources */ = { 251 | isa = PBXResourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | 92537B1E1ED57AE800A9F695 /* Resources */ = { 258 | isa = PBXResourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | /* End PBXResourcesBuildPhase section */ 265 | 266 | /* Begin PBXSourcesBuildPhase section */ 267 | 92537AFD1ED57AE600A9F695 /* Sources */ = { 268 | isa = PBXSourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | 92537B331ED57BE100A9F695 /* WeekView.swift in Sources */, 272 | 92537B071ED57AE600A9F695 /* ViewController.swift in Sources */, 273 | 92537B051ED57AE600A9F695 /* AppDelegate.swift in Sources */, 274 | 92537B351ED58B9900A9F695 /* WeekView+Extentions.swift in Sources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | 92537B111ED57AE800A9F695 /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | 92537B1A1ED57AE800A9F695 /* WeekCalendarDemoTests.swift in Sources */, 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | }; 286 | 92537B1C1ED57AE800A9F695 /* Sources */ = { 287 | isa = PBXSourcesBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | 92537B251ED57AE800A9F695 /* WeekCalendarDemoUITests.swift in Sources */, 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | /* End PBXSourcesBuildPhase section */ 295 | 296 | /* Begin PBXTargetDependency section */ 297 | 92537B171ED57AE800A9F695 /* PBXTargetDependency */ = { 298 | isa = PBXTargetDependency; 299 | target = 92537B001ED57AE600A9F695 /* WeekCalendarDemo */; 300 | targetProxy = 92537B161ED57AE800A9F695 /* PBXContainerItemProxy */; 301 | }; 302 | 92537B221ED57AE800A9F695 /* PBXTargetDependency */ = { 303 | isa = PBXTargetDependency; 304 | target = 92537B001ED57AE600A9F695 /* WeekCalendarDemo */; 305 | targetProxy = 92537B211ED57AE800A9F695 /* PBXContainerItemProxy */; 306 | }; 307 | /* End PBXTargetDependency section */ 308 | 309 | /* Begin PBXVariantGroup section */ 310 | 92537B081ED57AE600A9F695 /* Main.storyboard */ = { 311 | isa = PBXVariantGroup; 312 | children = ( 313 | 92537B091ED57AE600A9F695 /* Base */, 314 | ); 315 | name = Main.storyboard; 316 | sourceTree = ""; 317 | }; 318 | 92537B0D1ED57AE700A9F695 /* LaunchScreen.storyboard */ = { 319 | isa = PBXVariantGroup; 320 | children = ( 321 | 92537B0E1ED57AE700A9F695 /* Base */, 322 | ); 323 | name = LaunchScreen.storyboard; 324 | sourceTree = ""; 325 | }; 326 | /* End PBXVariantGroup section */ 327 | 328 | /* Begin XCBuildConfiguration section */ 329 | 92537B271ED57AE800A9F695 /* Debug */ = { 330 | isa = XCBuildConfiguration; 331 | buildSettings = { 332 | ALWAYS_SEARCH_USER_PATHS = NO; 333 | CLANG_ANALYZER_NONNULL = YES; 334 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 335 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 336 | CLANG_CXX_LIBRARY = "libc++"; 337 | CLANG_ENABLE_MODULES = YES; 338 | CLANG_ENABLE_OBJC_ARC = YES; 339 | CLANG_WARN_BOOL_CONVERSION = YES; 340 | CLANG_WARN_CONSTANT_CONVERSION = YES; 341 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 342 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 343 | CLANG_WARN_EMPTY_BODY = YES; 344 | CLANG_WARN_ENUM_CONVERSION = YES; 345 | CLANG_WARN_INFINITE_RECURSION = YES; 346 | CLANG_WARN_INT_CONVERSION = YES; 347 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 348 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 349 | CLANG_WARN_UNREACHABLE_CODE = YES; 350 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 351 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 352 | COPY_PHASE_STRIP = NO; 353 | DEBUG_INFORMATION_FORMAT = dwarf; 354 | ENABLE_STRICT_OBJC_MSGSEND = YES; 355 | ENABLE_TESTABILITY = YES; 356 | GCC_C_LANGUAGE_STANDARD = gnu99; 357 | GCC_DYNAMIC_NO_PIC = NO; 358 | GCC_NO_COMMON_BLOCKS = YES; 359 | GCC_OPTIMIZATION_LEVEL = 0; 360 | GCC_PREPROCESSOR_DEFINITIONS = ( 361 | "DEBUG=1", 362 | "$(inherited)", 363 | ); 364 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 365 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 366 | GCC_WARN_UNDECLARED_SELECTOR = YES; 367 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 368 | GCC_WARN_UNUSED_FUNCTION = YES; 369 | GCC_WARN_UNUSED_VARIABLE = YES; 370 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 371 | MTL_ENABLE_DEBUG_INFO = YES; 372 | ONLY_ACTIVE_ARCH = YES; 373 | SDKROOT = iphoneos; 374 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 375 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 376 | }; 377 | name = Debug; 378 | }; 379 | 92537B281ED57AE800A9F695 /* Release */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | ALWAYS_SEARCH_USER_PATHS = NO; 383 | CLANG_ANALYZER_NONNULL = YES; 384 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 385 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 386 | CLANG_CXX_LIBRARY = "libc++"; 387 | CLANG_ENABLE_MODULES = YES; 388 | CLANG_ENABLE_OBJC_ARC = YES; 389 | CLANG_WARN_BOOL_CONVERSION = YES; 390 | CLANG_WARN_CONSTANT_CONVERSION = YES; 391 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 392 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 393 | CLANG_WARN_EMPTY_BODY = YES; 394 | CLANG_WARN_ENUM_CONVERSION = YES; 395 | CLANG_WARN_INFINITE_RECURSION = YES; 396 | CLANG_WARN_INT_CONVERSION = YES; 397 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 398 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 399 | CLANG_WARN_UNREACHABLE_CODE = YES; 400 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 401 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 402 | COPY_PHASE_STRIP = NO; 403 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 404 | ENABLE_NS_ASSERTIONS = NO; 405 | ENABLE_STRICT_OBJC_MSGSEND = YES; 406 | GCC_C_LANGUAGE_STANDARD = gnu99; 407 | GCC_NO_COMMON_BLOCKS = YES; 408 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 410 | GCC_WARN_UNDECLARED_SELECTOR = YES; 411 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 412 | GCC_WARN_UNUSED_FUNCTION = YES; 413 | GCC_WARN_UNUSED_VARIABLE = YES; 414 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 415 | MTL_ENABLE_DEBUG_INFO = NO; 416 | SDKROOT = iphoneos; 417 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 418 | VALIDATE_PRODUCT = YES; 419 | }; 420 | name = Release; 421 | }; 422 | 92537B2A1ED57AE800A9F695 /* Debug */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 426 | DEVELOPMENT_TEAM = 7A6UCRCPF9; 427 | INFOPLIST_FILE = WeekCalendarDemo/Info.plist; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 429 | PRODUCT_BUNDLE_IDENTIFIER = com.duceretech.WeekCalendarDemo; 430 | PRODUCT_NAME = "$(TARGET_NAME)"; 431 | SWIFT_VERSION = 3.0; 432 | }; 433 | name = Debug; 434 | }; 435 | 92537B2B1ED57AE800A9F695 /* Release */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | DEVELOPMENT_TEAM = 7A6UCRCPF9; 440 | INFOPLIST_FILE = WeekCalendarDemo/Info.plist; 441 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 442 | PRODUCT_BUNDLE_IDENTIFIER = com.duceretech.WeekCalendarDemo; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | SWIFT_VERSION = 3.0; 445 | }; 446 | name = Release; 447 | }; 448 | 92537B2D1ED57AE800A9F695 /* Debug */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 452 | BUNDLE_LOADER = "$(TEST_HOST)"; 453 | DEVELOPMENT_TEAM = 7A6UCRCPF9; 454 | INFOPLIST_FILE = WeekCalendarDemoTests/Info.plist; 455 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 456 | PRODUCT_BUNDLE_IDENTIFIER = com.duceretech.WeekCalendarDemoTests; 457 | PRODUCT_NAME = "$(TARGET_NAME)"; 458 | SWIFT_VERSION = 3.0; 459 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/WeekCalendarDemo.app/WeekCalendarDemo"; 460 | }; 461 | name = Debug; 462 | }; 463 | 92537B2E1ED57AE800A9F695 /* Release */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 467 | BUNDLE_LOADER = "$(TEST_HOST)"; 468 | DEVELOPMENT_TEAM = 7A6UCRCPF9; 469 | INFOPLIST_FILE = WeekCalendarDemoTests/Info.plist; 470 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 471 | PRODUCT_BUNDLE_IDENTIFIER = com.duceretech.WeekCalendarDemoTests; 472 | PRODUCT_NAME = "$(TARGET_NAME)"; 473 | SWIFT_VERSION = 3.0; 474 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/WeekCalendarDemo.app/WeekCalendarDemo"; 475 | }; 476 | name = Release; 477 | }; 478 | 92537B301ED57AE800A9F695 /* Debug */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 482 | DEVELOPMENT_TEAM = 7A6UCRCPF9; 483 | INFOPLIST_FILE = WeekCalendarDemoUITests/Info.plist; 484 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 485 | PRODUCT_BUNDLE_IDENTIFIER = com.duceretech.WeekCalendarDemoUITests; 486 | PRODUCT_NAME = "$(TARGET_NAME)"; 487 | SWIFT_VERSION = 3.0; 488 | TEST_TARGET_NAME = WeekCalendarDemo; 489 | }; 490 | name = Debug; 491 | }; 492 | 92537B311ED57AE800A9F695 /* Release */ = { 493 | isa = XCBuildConfiguration; 494 | buildSettings = { 495 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 496 | DEVELOPMENT_TEAM = 7A6UCRCPF9; 497 | INFOPLIST_FILE = WeekCalendarDemoUITests/Info.plist; 498 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 499 | PRODUCT_BUNDLE_IDENTIFIER = com.duceretech.WeekCalendarDemoUITests; 500 | PRODUCT_NAME = "$(TARGET_NAME)"; 501 | SWIFT_VERSION = 3.0; 502 | TEST_TARGET_NAME = WeekCalendarDemo; 503 | }; 504 | name = Release; 505 | }; 506 | /* End XCBuildConfiguration section */ 507 | 508 | /* Begin XCConfigurationList section */ 509 | 92537AFC1ED57AE600A9F695 /* Build configuration list for PBXProject "WeekCalendarDemo" */ = { 510 | isa = XCConfigurationList; 511 | buildConfigurations = ( 512 | 92537B271ED57AE800A9F695 /* Debug */, 513 | 92537B281ED57AE800A9F695 /* Release */, 514 | ); 515 | defaultConfigurationIsVisible = 0; 516 | defaultConfigurationName = Release; 517 | }; 518 | 92537B291ED57AE800A9F695 /* Build configuration list for PBXNativeTarget "WeekCalendarDemo" */ = { 519 | isa = XCConfigurationList; 520 | buildConfigurations = ( 521 | 92537B2A1ED57AE800A9F695 /* Debug */, 522 | 92537B2B1ED57AE800A9F695 /* Release */, 523 | ); 524 | defaultConfigurationIsVisible = 0; 525 | }; 526 | 92537B2C1ED57AE800A9F695 /* Build configuration list for PBXNativeTarget "WeekCalendarDemoTests" */ = { 527 | isa = XCConfigurationList; 528 | buildConfigurations = ( 529 | 92537B2D1ED57AE800A9F695 /* Debug */, 530 | 92537B2E1ED57AE800A9F695 /* Release */, 531 | ); 532 | defaultConfigurationIsVisible = 0; 533 | }; 534 | 92537B2F1ED57AE800A9F695 /* Build configuration list for PBXNativeTarget "WeekCalendarDemoUITests" */ = { 535 | isa = XCConfigurationList; 536 | buildConfigurations = ( 537 | 92537B301ED57AE800A9F695 /* Debug */, 538 | 92537B311ED57AE800A9F695 /* Release */, 539 | ); 540 | defaultConfigurationIsVisible = 0; 541 | }; 542 | /* End XCConfigurationList section */ 543 | }; 544 | rootObject = 92537AF91ED57AE600A9F695 /* Project object */; 545 | } 546 | -------------------------------------------------------------------------------- /WeekCalendarDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WeekCalendarDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // WeekCalendarDemo 4 | // 5 | // Created by Ducere on 24/05/17. 6 | // Copyright © 2017 Ducere. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /WeekCalendarDemo/Assets.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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /WeekCalendarDemo/Base.lproj/LaunchScreen.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 | 27 | 28 | -------------------------------------------------------------------------------- /WeekCalendarDemo/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 | 27 | -------------------------------------------------------------------------------- /WeekCalendarDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /WeekCalendarDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // WeekCalendarDemo 4 | // 5 | // Created by Ducere on 24/05/17. 6 | // Copyright © 2017 Ducere. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, WeekViewDelegate { 12 | 13 | var calendarView : WeekView! = nil 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | // Do any additional setup after loading the view, typically from a nib. 18 | self.addCalenderView() 19 | } 20 | 21 | override func didReceiveMemoryWarning() { 22 | super.didReceiveMemoryWarning() 23 | // Dispose of any resources that can be recreated. 24 | } 25 | 26 | func addCalenderView() { 27 | calendarView = WeekView(frame: CGRect(x: 0, y: 60, width: self.view.frame.size.width, height: 60)) 28 | calendarView.backgroundColor = UIColor.groupTableViewBackground 29 | calendarView.delegate = self 30 | self.view.addSubview(calendarView) 31 | } 32 | 33 | func weekViewSelection(weekView: WeekView, didSelectedDate: Date) { 34 | print("Selected Date :@", didSelectedDate) 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /WeekCalendarDemo/WeekView+Extentions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WeekView+Extentions.swift 3 | // WeekCalendarDemo 4 | // 5 | // Created by Ducere on 24/05/17. 6 | // Copyright © 2017 Ducere. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class WeekView_Extentions: NSObject { 12 | 13 | } 14 | 15 | 16 | extension Date { 17 | 18 | func getWeekStartDate(fromDate : Date?) -> Date? { 19 | 20 | let dateFormatter = DateFormatter() 21 | dateFormatter.dateFormat = "yyyy-MM-dd" 22 | 23 | if let date = fromDate { 24 | let calendar = Calendar(identifier: .gregorian) 25 | 26 | var startDate : Date = Date() 27 | var interval : TimeInterval = 0 28 | 29 | if calendar.dateInterval(of: .weekOfYear, start: &startDate, interval: &interval, for: date) { 30 | print("Start of week is \(startDate)") 31 | // prints "Start of week is 2017-01-01 06:00:00 +0000" 32 | return startDate 33 | } 34 | } 35 | return nil 36 | } 37 | 38 | func getNextDay(value : Int, currentDate : Date?) -> Date? { 39 | 40 | let dayComponenet = NSDateComponents() 41 | dayComponenet.day = value 42 | 43 | let theCalendar = NSCalendar.current 44 | let nextDate = theCalendar.date(byAdding: dayComponenet as DateComponents, to: currentDate!) 45 | return nextDate 46 | 47 | } 48 | 49 | func dayOfWeek(date : Date) -> Int { 50 | var calendar = Calendar.current 51 | calendar.timeZone = NSTimeZone(name: "UTC")! as TimeZone 52 | let day = calendar.component(.day, from: date) 53 | return day 54 | } 55 | 56 | func monthOfWeek(date : Date) -> Int { 57 | var calendar = Calendar.current 58 | calendar.timeZone = NSTimeZone(name: "UTC")! as TimeZone 59 | let month = calendar.component(.month, from: date) 60 | return month 61 | } 62 | 63 | func yearOfWeek(date : Date) -> Int { 64 | var calendar = Calendar.current 65 | calendar.timeZone = NSTimeZone(name: "UTC")! as TimeZone 66 | let year = calendar.component(.year, from: date) 67 | return year 68 | } 69 | 70 | func fullDateToYear(date : Date) -> (day : Int, month : Int, year : Int) { 71 | var calendar = Calendar.current 72 | calendar.timeZone = NSTimeZone(name: "UTC")! as TimeZone 73 | let day = calendar.component(.day, from: date) 74 | let month = calendar.component(.month, from: date) 75 | let year = calendar.component(.year, from: date) 76 | return (day, month, year) 77 | } 78 | 79 | func getMonthAndYear(date : Date) -> String { 80 | 81 | let dateFormatter = DateFormatter() 82 | dateFormatter.dateFormat = "MMMM, yyyy" 83 | let newDate = dateFormatter.string(from: date) 84 | return newDate 85 | 86 | } 87 | 88 | func getDayNameFromDate(date : Date) -> String { 89 | let dateFormatter = DateFormatter() 90 | dateFormatter.locale = Locale(identifier: "en_US_POSIX") 91 | dateFormatter.timeZone = TimeZone(secondsFromGMT: 0) 92 | dateFormatter.dateFormat = "EE" 93 | let newDate = dateFormatter.string(from: date) 94 | return newDate 95 | } 96 | 97 | func getPreviousOrNextWeek(weekDate : Date, value : Int) -> Date? { 98 | 99 | let daysToAdd:Int = value 100 | // Set up date components 101 | let dateComponents: NSDateComponents = NSDateComponents() 102 | dateComponents.day = daysToAdd 103 | 104 | // Create a calendar 105 | let gregorianCalendar: NSCalendar = NSCalendar(identifier: NSCalendar.Identifier.gregorian)! 106 | let previousWeekEndDate: Date? = gregorianCalendar.date(byAdding: dateComponents as DateComponents, to: weekDate, options:NSCalendar.Options(rawValue: 0))! 107 | 108 | let weekStartDate = self.getWeekStartDate(fromDate: previousWeekEndDate) 109 | return weekStartDate 110 | } 111 | } 112 | 113 | -------------------------------------------------------------------------------- /WeekCalendarDemo/WeekView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WeekView.swift 3 | // WeekCalendarDemo 4 | // 5 | // Created by Ducere on 24/05/17. 6 | // Copyright © 2017 Ducere. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | struct WeekViewCons { 12 | 13 | static let weekViewCount = 7 14 | static let dayTitleViewHeight = 20 15 | static let dayTitleTagInitialVal = 100 16 | } 17 | 18 | protocol WeekViewDelegate { 19 | func weekViewSelection(weekView : WeekView, didSelectedDate : Date) 20 | } 21 | 22 | class WeekView: UIView { 23 | 24 | var monthNameLbl : UILabel! 25 | var dayInfoView : UIView! 26 | var weekStartDate : Date? 27 | var weekEndDate : Date? 28 | 29 | var dayTextColor : UIColor? 30 | 31 | var currentWeekDaysList : NSMutableArray = NSMutableArray() 32 | 33 | var delegate : WeekViewDelegate? 34 | 35 | var lightGrayColor : UIColor = { 36 | return UIColor.lightGray 37 | }() 38 | 39 | var dayFontFamily : UIFont? = { 40 | return UIFont(name: "Raleway-Regular", size: 12) 41 | }() 42 | 43 | var monthFont : UIFont? = { 44 | return UIFont(name: "Raleway-Regular", size: 16) 45 | }() 46 | 47 | 48 | //MARK:- Initial View setup 49 | override init(frame : CGRect) { 50 | super.init(frame: frame) 51 | 52 | self.addMothNameLable() 53 | addDayInfoSubView() 54 | } 55 | 56 | required init?(coder aDecoder: NSCoder) { 57 | fatalError("init(coder:) has not been implemented") 58 | } 59 | 60 | //MARK:- Add Subviews 61 | func addMothNameLable() { 62 | 63 | monthNameLbl = UILabel(frame: CGRect(x: 0, y: 0, width: self.frame.size.width, height: 20)) 64 | monthNameLbl.textAlignment = .center 65 | monthNameLbl.text = "July, 2017" 66 | monthNameLbl.font = monthFont 67 | self.addSubview(monthNameLbl) 68 | 69 | } 70 | 71 | func addDayInfoSubView() { 72 | 73 | dayInfoView = UIView(frame: CGRect(x: 0, y: 20, width: self.frame.size.width, height: 40)) 74 | self.addSubview(dayInfoView) 75 | 76 | let rightSwifeGesture = UISwipeGestureRecognizer(target: self, action: #selector(rightSwifeGestureAction(rightSwife:))) 77 | rightSwifeGesture.direction = .right 78 | self.addGestureRecognizer(rightSwifeGesture) 79 | 80 | let leftSwiftGesture = UISwipeGestureRecognizer(target: self, action: #selector(leftSwifeGestureAction(leftSwift:))) 81 | leftSwiftGesture.direction = .left 82 | self.addGestureRecognizer(leftSwiftGesture) 83 | 84 | initDailyViews() 85 | 86 | } 87 | 88 | func initDailyViews() { 89 | 90 | let dayWidth : CGFloat = self.bounds.size.width/CGFloat(WeekViewCons.weekViewCount) 91 | let today = Date() 92 | weekStartDate = today.getWeekStartDate(fromDate: today) 93 | for view in self.dayInfoView.subviews { 94 | view.removeFromSuperview() 95 | } 96 | 97 | currentWeekDaysList.removeAllObjects() 98 | 99 | for var i in 0.. (weekStartDate?.fullDateToYear(date: today))!) && ((weekStartDate?.monthOfWeek(date: date!))! >= (weekStartDate?.monthOfWeek(date: today))!)) || (((weekStartDate?.monthOfWeek(date: date!))! > (weekStartDate?.monthOfWeek(date: today))!) && ((weekStartDate?.yearOfWeek(date: date!))! >= (weekStartDate?.yearOfWeek(date: today))!)) { 136 | 137 | dayLbl.textColor = lightGrayColor 138 | 139 | } else { 140 | 141 | dayLbl.addGestureRecognizer(singleFingerTap) 142 | } 143 | 144 | dayInfoView.addSubview(dayLbl) 145 | 146 | } 147 | 148 | 149 | //MARK:- Gestures 150 | 151 | func dayTitleViewDidClick(singleTap : UITapGestureRecognizer) { 152 | 153 | var index = 0 154 | for view in self.dayInfoView.subviews { 155 | let anotherLbl : UILabel = view as! UILabel 156 | if anotherLbl.tag >= WeekViewCons.dayTitleTagInitialVal { 157 | anotherLbl.text = "\((weekStartDate?.dayOfWeek(date: currentWeekDaysList[index] as! Date))!)" 158 | index = index + 1 159 | } 160 | } 161 | 162 | let lbl : UILabel = singleTap.view as! UILabel 163 | lbl.text = weekStartDate?.getDayNameFromDate(date: currentWeekDaysList[lbl.tag - WeekViewCons.dayTitleTagInitialVal] as! Date) 164 | 165 | delegate?.weekViewSelection(weekView: self, didSelectedDate: currentWeekDaysList[lbl.tag - WeekViewCons.dayTitleTagInitialVal] as! Date) 166 | } 167 | 168 | func rightSwifeGestureAction(rightSwife : UISwipeGestureRecognizer) { 169 | print("Right Swife") 170 | directionSwifeAnimation(isSwiftRight: true, isToday: false, selectedDate: nil) 171 | } 172 | 173 | func leftSwifeGestureAction(leftSwift : UISwipeGestureRecognizer) { 174 | print("Left Swife") 175 | directionSwifeAnimation(isSwiftRight: false, isToday: false, selectedDate: nil) 176 | } 177 | 178 | func directionSwifeAnimation(isSwiftRight : Bool, isToday : Bool, selectedDate : Date?) { 179 | 180 | UIView.animate(withDuration: 0.5, delay: 0.0, options: .curveEaseInOut, animations: { 181 | if isSwiftRight == true { 182 | self.initPreviousOrNextViews(isNext: true) 183 | } else { 184 | self.initPreviousOrNextViews(isNext: false) 185 | } 186 | }) { (finished) in 187 | } 188 | } 189 | 190 | func initPreviousOrNextViews(isNext : Bool) { 191 | 192 | let dayWidth : CGFloat = self.bounds.size.width/CGFloat(WeekViewCons.weekViewCount) 193 | if !isNext { 194 | weekEndDate = currentWeekDaysList.lastObject as? Date 195 | weekStartDate = weekStartDate?.getPreviousOrNextWeek(weekDate: weekEndDate!, value: 1) 196 | } else { 197 | weekStartDate = weekStartDate?.getPreviousOrNextWeek(weekDate: weekStartDate!, value: -1) 198 | } 199 | for view in self.dayInfoView.subviews { 200 | view.removeFromSuperview() 201 | } 202 | 203 | currentWeekDaysList.removeAllObjects() 204 | 205 | for var i in 0.. 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /WeekCalendarDemoTests/WeekCalendarDemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WeekCalendarDemoTests.swift 3 | // WeekCalendarDemoTests 4 | // 5 | // Created by Ducere on 24/05/17. 6 | // Copyright © 2017 Ducere. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import WeekCalendarDemo 11 | 12 | class WeekCalendarDemoTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /WeekCalendarDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /WeekCalendarDemoUITests/WeekCalendarDemoUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WeekCalendarDemoUITests.swift 3 | // WeekCalendarDemoUITests 4 | // 5 | // Created by Ducere on 24/05/17. 6 | // Copyright © 2017 Ducere. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class WeekCalendarDemoUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------