├── .gitignore ├── DatePickerDialog.podspec ├── DatePickerDialog.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── DatePickerDialog.xcscheme │ └── DatePickerDialogExample.xcscheme ├── Demo ├── AppDelegate.swift ├── Resources │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ └── Info.plist ├── ViewController.swift └── Views │ ├── Launch Screen.storyboard │ └── Main.storyboard ├── LICENSE ├── Package.swift ├── README.mdown ├── Sources ├── Colors.swift ├── DatePickerDialog.swift ├── Info.plist └── UIColor+Ext.swift ├── Tests ├── DatePickerDialogTests.swift └── Info.plist └── images └── screen1.png /.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 | .swiftpm/ 20 | 21 | ## Other 22 | *.xccheckout 23 | *.moved-aside 24 | *.xcuserstate 25 | *.xcscmblueprint 26 | 27 | ## Obj-C/Swift specific 28 | *.hmap 29 | *.ipa 30 | 31 | # Carthage 32 | # 33 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 34 | # Carthage/Checkouts 35 | 36 | Carthage/Build 37 | 38 | # Mac 39 | .DS_Store 40 | -------------------------------------------------------------------------------- /DatePickerDialog.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "DatePickerDialog" 3 | s.version = "4.0" 4 | s.summary = "Date picker dialog for iOS" 5 | s.homepage = "https://github.com/squimer/DatePickerDialog-iOS-Swift" 6 | s.license = { :type => "MIT", :file => "LICENSE" } 7 | s.author = { "Vini Soares" => "vinis@protonmail.com", "Lucas Farah" => "lucas.farah@me.com" } 8 | s.social_media_url = "https://twitter.com/0vinisoares" 9 | s.platform = :ios 10 | s.ios.deployment_target = "8.0" 11 | s.source = { :git => "https://github.com/squimer/DatePickerDialog-iOS-Swift.git", :tag => s.version } 12 | s.source_files = "Sources/*.swift" 13 | s.requires_arc = true 14 | s.swift_version = '5.0' 15 | end 16 | -------------------------------------------------------------------------------- /DatePickerDialog.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 244F549325388FAE00A849CC /* UIColor+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 244F549225388FAE00A849CC /* UIColor+Ext.swift */; }; 11 | 244F54952538940A00A849CC /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 244F54942538940A00A849CC /* Colors.swift */; }; 12 | 272D1E3523942CC100199BB5 /* DatePickerDialog.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BDE05A31D8F3AF000DEF7F3 /* DatePickerDialog.framework */; }; 13 | 272D1E3623942CC100199BB5 /* DatePickerDialog.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4BDE05A31D8F3AF000DEF7F3 /* DatePickerDialog.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 14 | 4B025BE61D8F46E2000CF209 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B025BDE1D8F46E2000CF209 /* AppDelegate.swift */; }; 15 | 4B025BE91D8F46E2000CF209 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B025BE21D8F46E2000CF209 /* ViewController.swift */; }; 16 | 4B025BEA1D8F46E2000CF209 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B025BE41D8F46E2000CF209 /* Launch Screen.storyboard */; }; 17 | 4B025BEB1D8F46E2000CF209 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B025BE51D8F46E2000CF209 /* Main.storyboard */; }; 18 | 4B025BEF1D8F4766000CF209 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B025BED1D8F4766000CF209 /* Assets.xcassets */; }; 19 | 4BDE05AD1D8F3AF000DEF7F3 /* DatePickerDialog.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BDE05A31D8F3AF000DEF7F3 /* DatePickerDialog.framework */; }; 20 | 4BDE05C51D8F3B7D00DEF7F3 /* DatePickerDialog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BDE05C01D8F3B7C00DEF7F3 /* DatePickerDialog.swift */; }; 21 | 4BDE05C91D8F3B8500DEF7F3 /* DatePickerDialogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BDE05C31D8F3B7D00DEF7F3 /* DatePickerDialogTests.swift */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | 4BDE05AE1D8F3AF000DEF7F3 /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = 4BDE059A1D8F3AF000DEF7F3 /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = 4BDE05A21D8F3AF000DEF7F3; 30 | remoteInfo = DatePickerDialog; 31 | }; 32 | /* End PBXContainerItemProxy section */ 33 | 34 | /* Begin PBXCopyFilesBuildPhase section */ 35 | 272D1E3723942CC100199BB5 /* Embed Frameworks */ = { 36 | isa = PBXCopyFilesBuildPhase; 37 | buildActionMask = 2147483647; 38 | dstPath = ""; 39 | dstSubfolderSpec = 10; 40 | files = ( 41 | 272D1E3623942CC100199BB5 /* DatePickerDialog.framework in Embed Frameworks */, 42 | ); 43 | name = "Embed Frameworks"; 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXCopyFilesBuildPhase section */ 47 | 48 | /* Begin PBXFileReference section */ 49 | 244F549225388FAE00A849CC /* UIColor+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Ext.swift"; sourceTree = ""; }; 50 | 244F54942538940A00A849CC /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = ""; }; 51 | 4B025BDE1D8F46E2000CF209 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 52 | 4B025BE21D8F46E2000CF209 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 53 | 4B025BE41D8F46E2000CF209 /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; 54 | 4B025BE51D8F46E2000CF209 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 55 | 4B025BED1D8F4766000CF209 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 4B1E9F371D8F3C9A00C1EF25 /* DatePickerDialogExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DatePickerDialogExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 4BDE05A31D8F3AF000DEF7F3 /* DatePickerDialog.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DatePickerDialog.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | 4BDE05AC1D8F3AF000DEF7F3 /* DatePickerDialogTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DatePickerDialogTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 4BDE05C01D8F3B7C00DEF7F3 /* DatePickerDialog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatePickerDialog.swift; sourceTree = ""; }; 60 | 4BDE05C31D8F3B7D00DEF7F3 /* DatePickerDialogTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatePickerDialogTests.swift; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 4B1E9F341D8F3C9A00C1EF25 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | 272D1E3523942CC100199BB5 /* DatePickerDialog.framework in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | 4BDE059F1D8F3AF000DEF7F3 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | 4BDE05A91D8F3AF000DEF7F3 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | 4BDE05AD1D8F3AF000DEF7F3 /* DatePickerDialog.framework in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 4B025BE31D8F46E2000CF209 /* Views */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 4B025BE41D8F46E2000CF209 /* Launch Screen.storyboard */, 94 | 4B025BE51D8F46E2000CF209 /* Main.storyboard */, 95 | ); 96 | path = Views; 97 | sourceTree = ""; 98 | }; 99 | 4B025BEC1D8F4766000CF209 /* Resources */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 4B025BED1D8F4766000CF209 /* Assets.xcassets */, 103 | ); 104 | path = Resources; 105 | sourceTree = ""; 106 | }; 107 | 4B1E9F491D8F3CED00C1EF25 /* Demo */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 4B025BEC1D8F4766000CF209 /* Resources */, 111 | 4B025BE31D8F46E2000CF209 /* Views */, 112 | 4B025BDE1D8F46E2000CF209 /* AppDelegate.swift */, 113 | 4B025BE21D8F46E2000CF209 /* ViewController.swift */, 114 | ); 115 | path = Demo; 116 | sourceTree = ""; 117 | }; 118 | 4BDE05991D8F3AF000DEF7F3 = { 119 | isa = PBXGroup; 120 | children = ( 121 | 4BDE05BF1D8F3B7C00DEF7F3 /* Sources */, 122 | 4BDE05C21D8F3B7C00DEF7F3 /* Tests */, 123 | 4B1E9F491D8F3CED00C1EF25 /* Demo */, 124 | 4BDE05A41D8F3AF000DEF7F3 /* Products */, 125 | ); 126 | sourceTree = ""; 127 | }; 128 | 4BDE05A41D8F3AF000DEF7F3 /* Products */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 4BDE05A31D8F3AF000DEF7F3 /* DatePickerDialog.framework */, 132 | 4BDE05AC1D8F3AF000DEF7F3 /* DatePickerDialogTests.xctest */, 133 | 4B1E9F371D8F3C9A00C1EF25 /* DatePickerDialogExample.app */, 134 | ); 135 | name = Products; 136 | sourceTree = ""; 137 | }; 138 | 4BDE05BF1D8F3B7C00DEF7F3 /* Sources */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 4BDE05C01D8F3B7C00DEF7F3 /* DatePickerDialog.swift */, 142 | 244F549225388FAE00A849CC /* UIColor+Ext.swift */, 143 | 244F54942538940A00A849CC /* Colors.swift */, 144 | ); 145 | path = Sources; 146 | sourceTree = ""; 147 | }; 148 | 4BDE05C21D8F3B7C00DEF7F3 /* Tests */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | 4BDE05C31D8F3B7D00DEF7F3 /* DatePickerDialogTests.swift */, 152 | ); 153 | path = Tests; 154 | sourceTree = ""; 155 | }; 156 | /* End PBXGroup section */ 157 | 158 | /* Begin PBXHeadersBuildPhase section */ 159 | 4BDE05A01D8F3AF000DEF7F3 /* Headers */ = { 160 | isa = PBXHeadersBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXHeadersBuildPhase section */ 167 | 168 | /* Begin PBXNativeTarget section */ 169 | 4B1E9F361D8F3C9A00C1EF25 /* DatePickerDialogExample */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 4B1E9F481D8F3C9A00C1EF25 /* Build configuration list for PBXNativeTarget "DatePickerDialogExample" */; 172 | buildPhases = ( 173 | 4B1E9F331D8F3C9A00C1EF25 /* Sources */, 174 | 4B1E9F341D8F3C9A00C1EF25 /* Frameworks */, 175 | 4B1E9F351D8F3C9A00C1EF25 /* Resources */, 176 | 272D1E3723942CC100199BB5 /* Embed Frameworks */, 177 | ); 178 | buildRules = ( 179 | ); 180 | dependencies = ( 181 | ); 182 | name = DatePickerDialogExample; 183 | productName = DatePickerDialogExample; 184 | productReference = 4B1E9F371D8F3C9A00C1EF25 /* DatePickerDialogExample.app */; 185 | productType = "com.apple.product-type.application"; 186 | }; 187 | 4BDE05A21D8F3AF000DEF7F3 /* DatePickerDialog */ = { 188 | isa = PBXNativeTarget; 189 | buildConfigurationList = 4BDE05B71D8F3AF000DEF7F3 /* Build configuration list for PBXNativeTarget "DatePickerDialog" */; 190 | buildPhases = ( 191 | 4BDE059E1D8F3AF000DEF7F3 /* Sources */, 192 | 4BDE059F1D8F3AF000DEF7F3 /* Frameworks */, 193 | 4BDE05A01D8F3AF000DEF7F3 /* Headers */, 194 | 4BDE05A11D8F3AF000DEF7F3 /* Resources */, 195 | ); 196 | buildRules = ( 197 | ); 198 | dependencies = ( 199 | ); 200 | name = DatePickerDialog; 201 | productName = DatePickerDialog; 202 | productReference = 4BDE05A31D8F3AF000DEF7F3 /* DatePickerDialog.framework */; 203 | productType = "com.apple.product-type.framework"; 204 | }; 205 | 4BDE05AB1D8F3AF000DEF7F3 /* DatePickerDialogTests */ = { 206 | isa = PBXNativeTarget; 207 | buildConfigurationList = 4BDE05BA1D8F3AF000DEF7F3 /* Build configuration list for PBXNativeTarget "DatePickerDialogTests" */; 208 | buildPhases = ( 209 | 4BDE05A81D8F3AF000DEF7F3 /* Sources */, 210 | 4BDE05A91D8F3AF000DEF7F3 /* Frameworks */, 211 | 4BDE05AA1D8F3AF000DEF7F3 /* Resources */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | 4BDE05AF1D8F3AF000DEF7F3 /* PBXTargetDependency */, 217 | ); 218 | name = DatePickerDialogTests; 219 | productName = DatePickerDialogTests; 220 | productReference = 4BDE05AC1D8F3AF000DEF7F3 /* DatePickerDialogTests.xctest */; 221 | productType = "com.apple.product-type.bundle.unit-test"; 222 | }; 223 | /* End PBXNativeTarget section */ 224 | 225 | /* Begin PBXProject section */ 226 | 4BDE059A1D8F3AF000DEF7F3 /* Project object */ = { 227 | isa = PBXProject; 228 | attributes = { 229 | LastSwiftUpdateCheck = 0800; 230 | LastUpgradeCheck = 1020; 231 | ORGANIZATIONNAME = squimer; 232 | TargetAttributes = { 233 | 4B1E9F361D8F3C9A00C1EF25 = { 234 | CreatedOnToolsVersion = 8.0; 235 | DevelopmentTeam = FQCZQ8XV2G; 236 | LastSwiftMigration = 0800; 237 | ProvisioningStyle = Automatic; 238 | }; 239 | 4BDE05A21D8F3AF000DEF7F3 = { 240 | CreatedOnToolsVersion = 8.0; 241 | DevelopmentTeam = FQCZQ8XV2G; 242 | LastSwiftMigration = 0900; 243 | ProvisioningStyle = Automatic; 244 | }; 245 | 4BDE05AB1D8F3AF000DEF7F3 = { 246 | CreatedOnToolsVersion = 8.0; 247 | LastSwiftMigration = 0900; 248 | ProvisioningStyle = Automatic; 249 | }; 250 | }; 251 | }; 252 | buildConfigurationList = 4BDE059D1D8F3AF000DEF7F3 /* Build configuration list for PBXProject "DatePickerDialog" */; 253 | compatibilityVersion = "Xcode 3.2"; 254 | developmentRegion = en; 255 | hasScannedForEncodings = 0; 256 | knownRegions = ( 257 | en, 258 | Base, 259 | ); 260 | mainGroup = 4BDE05991D8F3AF000DEF7F3; 261 | productRefGroup = 4BDE05A41D8F3AF000DEF7F3 /* Products */; 262 | projectDirPath = ""; 263 | projectRoot = ""; 264 | targets = ( 265 | 4BDE05A21D8F3AF000DEF7F3 /* DatePickerDialog */, 266 | 4BDE05AB1D8F3AF000DEF7F3 /* DatePickerDialogTests */, 267 | 4B1E9F361D8F3C9A00C1EF25 /* DatePickerDialogExample */, 268 | ); 269 | }; 270 | /* End PBXProject section */ 271 | 272 | /* Begin PBXResourcesBuildPhase section */ 273 | 4B1E9F351D8F3C9A00C1EF25 /* Resources */ = { 274 | isa = PBXResourcesBuildPhase; 275 | buildActionMask = 2147483647; 276 | files = ( 277 | 4B025BEA1D8F46E2000CF209 /* Launch Screen.storyboard in Resources */, 278 | 4B025BEF1D8F4766000CF209 /* Assets.xcassets in Resources */, 279 | 4B025BEB1D8F46E2000CF209 /* Main.storyboard in Resources */, 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | 4BDE05A11D8F3AF000DEF7F3 /* Resources */ = { 284 | isa = PBXResourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | 4BDE05AA1D8F3AF000DEF7F3 /* Resources */ = { 291 | isa = PBXResourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | /* End PBXResourcesBuildPhase section */ 298 | 299 | /* Begin PBXSourcesBuildPhase section */ 300 | 4B1E9F331D8F3C9A00C1EF25 /* Sources */ = { 301 | isa = PBXSourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | 4B025BE91D8F46E2000CF209 /* ViewController.swift in Sources */, 305 | 4B025BE61D8F46E2000CF209 /* AppDelegate.swift in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | 4BDE059E1D8F3AF000DEF7F3 /* Sources */ = { 310 | isa = PBXSourcesBuildPhase; 311 | buildActionMask = 2147483647; 312 | files = ( 313 | 4BDE05C51D8F3B7D00DEF7F3 /* DatePickerDialog.swift in Sources */, 314 | 244F54952538940A00A849CC /* Colors.swift in Sources */, 315 | 244F549325388FAE00A849CC /* UIColor+Ext.swift in Sources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | 4BDE05A81D8F3AF000DEF7F3 /* Sources */ = { 320 | isa = PBXSourcesBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | 4BDE05C91D8F3B8500DEF7F3 /* DatePickerDialogTests.swift in Sources */, 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | }; 327 | /* End PBXSourcesBuildPhase section */ 328 | 329 | /* Begin PBXTargetDependency section */ 330 | 4BDE05AF1D8F3AF000DEF7F3 /* PBXTargetDependency */ = { 331 | isa = PBXTargetDependency; 332 | target = 4BDE05A21D8F3AF000DEF7F3 /* DatePickerDialog */; 333 | targetProxy = 4BDE05AE1D8F3AF000DEF7F3 /* PBXContainerItemProxy */; 334 | }; 335 | /* End PBXTargetDependency section */ 336 | 337 | /* Begin XCBuildConfiguration section */ 338 | 4B1E9F461D8F3C9A00C1EF25 /* Debug */ = { 339 | isa = XCBuildConfiguration; 340 | buildSettings = { 341 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 342 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 343 | CLANG_ENABLE_MODULES = YES; 344 | DEVELOPMENT_TEAM = FQCZQ8XV2G; 345 | INFOPLIST_FILE = "$(SRCROOT)/Demo/Resources/Info.plist"; 346 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 347 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 348 | MARKETING_VERSION = 4.0; 349 | PRODUCT_BUNDLE_IDENTIFIER = squimer.DatePickerDialogExample; 350 | PRODUCT_NAME = "$(TARGET_NAME)"; 351 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 352 | SWIFT_VERSION = 5.0; 353 | }; 354 | name = Debug; 355 | }; 356 | 4B1E9F471D8F3C9A00C1EF25 /* Release */ = { 357 | isa = XCBuildConfiguration; 358 | buildSettings = { 359 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 360 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 361 | CLANG_ENABLE_MODULES = YES; 362 | DEVELOPMENT_TEAM = FQCZQ8XV2G; 363 | INFOPLIST_FILE = "$(SRCROOT)/Demo/Resources/Info.plist"; 364 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 365 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 366 | MARKETING_VERSION = 4.0; 367 | PRODUCT_BUNDLE_IDENTIFIER = squimer.DatePickerDialogExample; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | SWIFT_VERSION = 5.0; 370 | }; 371 | name = Release; 372 | }; 373 | 4BDE05B51D8F3AF000DEF7F3 /* Debug */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ALWAYS_SEARCH_USER_PATHS = NO; 377 | CLANG_ANALYZER_NONNULL = YES; 378 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 379 | CLANG_CXX_LIBRARY = "libc++"; 380 | CLANG_ENABLE_MODULES = YES; 381 | CLANG_ENABLE_OBJC_ARC = YES; 382 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 383 | CLANG_WARN_BOOL_CONVERSION = YES; 384 | CLANG_WARN_COMMA = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 387 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 388 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 389 | CLANG_WARN_EMPTY_BODY = YES; 390 | CLANG_WARN_ENUM_CONVERSION = YES; 391 | CLANG_WARN_INFINITE_RECURSION = YES; 392 | CLANG_WARN_INT_CONVERSION = YES; 393 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 394 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 395 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 396 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 397 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 398 | CLANG_WARN_STRICT_PROTOTYPES = YES; 399 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 400 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 401 | CLANG_WARN_UNREACHABLE_CODE = YES; 402 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 403 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 404 | COPY_PHASE_STRIP = NO; 405 | CURRENT_PROJECT_VERSION = 1; 406 | DEBUG_INFORMATION_FORMAT = dwarf; 407 | ENABLE_STRICT_OBJC_MSGSEND = YES; 408 | ENABLE_TESTABILITY = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_DYNAMIC_NO_PIC = NO; 411 | GCC_NO_COMMON_BLOCKS = YES; 412 | GCC_OPTIMIZATION_LEVEL = 0; 413 | GCC_PREPROCESSOR_DEFINITIONS = ( 414 | "DEBUG=1", 415 | "$(inherited)", 416 | ); 417 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 418 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 419 | GCC_WARN_UNDECLARED_SELECTOR = YES; 420 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 421 | GCC_WARN_UNUSED_FUNCTION = YES; 422 | GCC_WARN_UNUSED_VARIABLE = YES; 423 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 424 | MTL_ENABLE_DEBUG_INFO = YES; 425 | ONLY_ACTIVE_ARCH = YES; 426 | SDKROOT = iphoneos; 427 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 428 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 429 | TARGETED_DEVICE_FAMILY = "1,2"; 430 | VERSIONING_SYSTEM = "apple-generic"; 431 | VERSION_INFO_PREFIX = ""; 432 | }; 433 | name = Debug; 434 | }; 435 | 4BDE05B61D8F3AF000DEF7F3 /* Release */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ALWAYS_SEARCH_USER_PATHS = NO; 439 | CLANG_ANALYZER_NONNULL = YES; 440 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 441 | CLANG_CXX_LIBRARY = "libc++"; 442 | CLANG_ENABLE_MODULES = YES; 443 | CLANG_ENABLE_OBJC_ARC = YES; 444 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 445 | CLANG_WARN_BOOL_CONVERSION = YES; 446 | CLANG_WARN_COMMA = YES; 447 | CLANG_WARN_CONSTANT_CONVERSION = YES; 448 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 449 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 450 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 451 | CLANG_WARN_EMPTY_BODY = YES; 452 | CLANG_WARN_ENUM_CONVERSION = YES; 453 | CLANG_WARN_INFINITE_RECURSION = YES; 454 | CLANG_WARN_INT_CONVERSION = YES; 455 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 456 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 457 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 458 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 459 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 460 | CLANG_WARN_STRICT_PROTOTYPES = YES; 461 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 462 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 463 | CLANG_WARN_UNREACHABLE_CODE = YES; 464 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 465 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 466 | COPY_PHASE_STRIP = NO; 467 | CURRENT_PROJECT_VERSION = 1; 468 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 469 | ENABLE_NS_ASSERTIONS = NO; 470 | ENABLE_STRICT_OBJC_MSGSEND = YES; 471 | GCC_C_LANGUAGE_STANDARD = gnu99; 472 | GCC_NO_COMMON_BLOCKS = YES; 473 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 474 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 475 | GCC_WARN_UNDECLARED_SELECTOR = YES; 476 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 477 | GCC_WARN_UNUSED_FUNCTION = YES; 478 | GCC_WARN_UNUSED_VARIABLE = YES; 479 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 480 | MTL_ENABLE_DEBUG_INFO = NO; 481 | SDKROOT = iphoneos; 482 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 483 | TARGETED_DEVICE_FAMILY = "1,2"; 484 | VALIDATE_PRODUCT = YES; 485 | VERSIONING_SYSTEM = "apple-generic"; 486 | VERSION_INFO_PREFIX = ""; 487 | }; 488 | name = Release; 489 | }; 490 | 4BDE05B81D8F3AF000DEF7F3 /* Debug */ = { 491 | isa = XCBuildConfiguration; 492 | buildSettings = { 493 | CLANG_ENABLE_MODULES = YES; 494 | CODE_SIGN_IDENTITY = "Apple Development"; 495 | DEFINES_MODULE = YES; 496 | DEVELOPMENT_TEAM = FQCZQ8XV2G; 497 | DYLIB_COMPATIBILITY_VERSION = 1; 498 | DYLIB_CURRENT_VERSION = 1; 499 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 500 | INFOPLIST_FILE = Sources/Info.plist; 501 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 502 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 503 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 504 | MARKETING_VERSION = 4.0; 505 | PRODUCT_BUNDLE_IDENTIFIER = squimer.DatePickerDialog; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | SKIP_INSTALL = YES; 508 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 509 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 510 | SWIFT_VERSION = 5.0; 511 | }; 512 | name = Debug; 513 | }; 514 | 4BDE05B91D8F3AF000DEF7F3 /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | CLANG_ENABLE_MODULES = YES; 518 | CODE_SIGN_IDENTITY = "Apple Development"; 519 | DEFINES_MODULE = YES; 520 | DEVELOPMENT_TEAM = FQCZQ8XV2G; 521 | DYLIB_COMPATIBILITY_VERSION = 1; 522 | DYLIB_CURRENT_VERSION = 1; 523 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 524 | INFOPLIST_FILE = Sources/Info.plist; 525 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 526 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 527 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 528 | MARKETING_VERSION = 4.0; 529 | PRODUCT_BUNDLE_IDENTIFIER = squimer.DatePickerDialog; 530 | PRODUCT_NAME = "$(TARGET_NAME)"; 531 | SKIP_INSTALL = YES; 532 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 533 | SWIFT_VERSION = 5.0; 534 | }; 535 | name = Release; 536 | }; 537 | 4BDE05BB1D8F3AF000DEF7F3 /* Debug */ = { 538 | isa = XCBuildConfiguration; 539 | buildSettings = { 540 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 541 | INFOPLIST_FILE = Tests/Info.plist; 542 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 543 | PRODUCT_BUNDLE_IDENTIFIER = squimer.DatePickerDialogTests; 544 | PRODUCT_NAME = "$(TARGET_NAME)"; 545 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 546 | SWIFT_VERSION = 5.0; 547 | }; 548 | name = Debug; 549 | }; 550 | 4BDE05BC1D8F3AF000DEF7F3 /* Release */ = { 551 | isa = XCBuildConfiguration; 552 | buildSettings = { 553 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 554 | INFOPLIST_FILE = Tests/Info.plist; 555 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 556 | PRODUCT_BUNDLE_IDENTIFIER = squimer.DatePickerDialogTests; 557 | PRODUCT_NAME = "$(TARGET_NAME)"; 558 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 559 | SWIFT_VERSION = 5.0; 560 | }; 561 | name = Release; 562 | }; 563 | /* End XCBuildConfiguration section */ 564 | 565 | /* Begin XCConfigurationList section */ 566 | 4B1E9F481D8F3C9A00C1EF25 /* Build configuration list for PBXNativeTarget "DatePickerDialogExample" */ = { 567 | isa = XCConfigurationList; 568 | buildConfigurations = ( 569 | 4B1E9F461D8F3C9A00C1EF25 /* Debug */, 570 | 4B1E9F471D8F3C9A00C1EF25 /* Release */, 571 | ); 572 | defaultConfigurationIsVisible = 0; 573 | defaultConfigurationName = Release; 574 | }; 575 | 4BDE059D1D8F3AF000DEF7F3 /* Build configuration list for PBXProject "DatePickerDialog" */ = { 576 | isa = XCConfigurationList; 577 | buildConfigurations = ( 578 | 4BDE05B51D8F3AF000DEF7F3 /* Debug */, 579 | 4BDE05B61D8F3AF000DEF7F3 /* Release */, 580 | ); 581 | defaultConfigurationIsVisible = 0; 582 | defaultConfigurationName = Release; 583 | }; 584 | 4BDE05B71D8F3AF000DEF7F3 /* Build configuration list for PBXNativeTarget "DatePickerDialog" */ = { 585 | isa = XCConfigurationList; 586 | buildConfigurations = ( 587 | 4BDE05B81D8F3AF000DEF7F3 /* Debug */, 588 | 4BDE05B91D8F3AF000DEF7F3 /* Release */, 589 | ); 590 | defaultConfigurationIsVisible = 0; 591 | defaultConfigurationName = Release; 592 | }; 593 | 4BDE05BA1D8F3AF000DEF7F3 /* Build configuration list for PBXNativeTarget "DatePickerDialogTests" */ = { 594 | isa = XCConfigurationList; 595 | buildConfigurations = ( 596 | 4BDE05BB1D8F3AF000DEF7F3 /* Debug */, 597 | 4BDE05BC1D8F3AF000DEF7F3 /* Release */, 598 | ); 599 | defaultConfigurationIsVisible = 0; 600 | defaultConfigurationName = Release; 601 | }; 602 | /* End XCConfigurationList section */ 603 | }; 604 | rootObject = 4BDE059A1D8F3AF000DEF7F3 /* Project object */; 605 | } 606 | -------------------------------------------------------------------------------- /DatePickerDialog.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DatePickerDialog.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DatePickerDialog.xcodeproj/xcshareddata/xcschemes/DatePickerDialog.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /DatePickerDialog.xcodeproj/xcshareddata/xcschemes/DatePickerDialogExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Demo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | @UIApplicationMain 4 | class AppDelegate: UIResponder, UIApplicationDelegate { 5 | var window: UIWindow? 6 | } 7 | -------------------------------------------------------------------------------- /Demo/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Demo/Resources/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Demo/Resources/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "1x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "extent" : "full-screen", 14 | "minimum-system-version" : "7.0", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "portrait", 19 | "idiom" : "ipad", 20 | "extent" : "full-screen", 21 | "minimum-system-version" : "7.0", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "landscape", 26 | "idiom" : "ipad", 27 | "extent" : "full-screen", 28 | "minimum-system-version" : "7.0", 29 | "scale" : "2x" 30 | }, 31 | { 32 | "orientation" : "portrait", 33 | "idiom" : "iphone", 34 | "minimum-system-version" : "7.0", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "orientation" : "portrait", 39 | "idiom" : "iphone", 40 | "minimum-system-version" : "7.0", 41 | "subtype" : "retina4", 42 | "scale" : "2x" 43 | } 44 | ], 45 | "info" : { 46 | "version" : 1, 47 | "author" : "xcode" 48 | } 49 | } -------------------------------------------------------------------------------- /Demo/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIcons 10 | 11 | CFBundleIcons~ipad 12 | 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | $(PRODUCT_NAME) 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $(MARKETING_VERSION) 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | Launch Screen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Demo/ViewController.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import DatePickerDialog 3 | 4 | class ViewController: UIViewController { 5 | @IBOutlet weak var textField: UITextField! 6 | 7 | let datePicker = DatePickerDialog() 8 | 9 | override func viewDidLoad() { 10 | super.viewDidLoad() 11 | textField.delegate = self 12 | } 13 | 14 | func datePickerTapped() { 15 | let currentDate = Date() 16 | var dateComponents = DateComponents() 17 | dateComponents.month = -3 18 | let threeMonthAgo = Calendar.current.date(byAdding: dateComponents, to: currentDate) 19 | 20 | datePicker.show("DatePickerDialog", 21 | doneButtonTitle: "Done", 22 | cancelButtonTitle: "Cancel", 23 | minimumDate: threeMonthAgo, 24 | maximumDate: currentDate, 25 | datePickerMode: .date) { (date) in 26 | if let dt = date { 27 | let formatter = DateFormatter() 28 | formatter.dateFormat = "MM/dd/yyyy" 29 | self.textField.text = formatter.string(from: dt) 30 | } 31 | } 32 | } 33 | } 34 | 35 | extension ViewController: UITextFieldDelegate { 36 | 37 | func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { 38 | if textField == self.textField { 39 | datePickerTapped() 40 | return false 41 | } 42 | 43 | return true 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Demo/Views/Launch Screen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Demo/Views/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 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Vinícius (Squimer) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "DatePickerDialog", 7 | platforms: [ 8 | .iOS(.v11) 9 | ], 10 | products: [ 11 | .library( 12 | name: "DatePickerDialog", 13 | targets: ["DatePickerDialog"]) 14 | ], 15 | targets: [ 16 | .target( 17 | name: "DatePickerDialog", 18 | dependencies: [], 19 | path: "Sources" 20 | ), 21 | .testTarget( 22 | name: "DatePickerDialogTests", 23 | dependencies: ["DatePickerDialog"], 24 | path: "Tests" 25 | ) 26 | ] 27 | ) 28 | -------------------------------------------------------------------------------- /README.mdown: -------------------------------------------------------------------------------- 1 | # DatePickerDialog 4.0 - iOS - Swift 2 | 3 | DatePickerDialog is an iOS drop-in classe that displays an UIDatePicker within an UIAlertView. 4 | 5 | [![](https://raw.githubusercontent.com/squimer/DatePickerDialog-iOS-Swift/master/images/screen1.png)](https://github.com/squimer/DatePickerDialog-iOS-Swift/tree/master/images) 6 | 7 | ## Requirements 8 | 9 | DatePickerDialog works on iOS 7, 8 and 9, 10, 11, 12, 13 and 14. It depends on the following Apple frameworks, which should already be included with most Xcode templates: 10 | 11 | * Foundation 12 | * UIKit 13 | 14 | #### Swift Versions 15 | - Swift 5.3 (Current) 16 | - Swift 4.2 (```3.0``` tag) 17 | - Swift 4.2 (```2.1``` tag) 18 | - Swift 4.2 (```2.0``` tag) 19 | - Swift 2.3 (```swift_2.3``` branch) 20 | 21 | ## Installation 22 | #### CocoaPods 23 | 24 | You can use [CocoaPods](http://cocoapods.org/) to install `DatePickerDialog` by adding it to your `Podfile`: 25 | 26 | ```ruby 27 | platform :ios, '8.0' 28 | use_frameworks! 29 | pod 'DatePickerDialog' 30 | ``` 31 | 32 | To get the full benefits import `DatePickerDialog` wherever you import UIKit 33 | 34 | ``` swift 35 | import UIKit 36 | import DatePickerDialog 37 | ``` 38 | #### Carthage 39 | Create a `Cartfile` that lists the framework and run `carthage bootstrap`. Follow the [instructions](https://github.com/Carthage/Carthage#if-youre-building-for-ios) to add `$(SRCROOT)/Carthage/Build/iOS/DatePickerDialogFramework.framework` to an iOS project. 40 | 41 | ``` 42 | github "squimer/DatePickerDialog-iOS-Swift" 43 | ``` 44 | 45 | #### Manually 46 | 1. Download and drop ```DatePickerDialog.swift``` in your project. 47 | 2. Congratulations! 48 | 49 | ## Example 50 | 51 | ```swift 52 | func datePickerTapped() { 53 | DatePickerDialog().show(title: "DatePicker", doneButtonTitle: "Done", cancelButtonTitle: "Cancel", datePickerMode: .date) { date in 54 | if let dt = date { 55 | let formatter = DateFormatter() 56 | formatter.dateFormat = "MM/dd/yyyy" 57 | self.textField.text = formatter.string(from: dt) 58 | } 59 | } 60 | } 61 | ``` 62 | 63 | ## Dialog parameters 64 | 65 | - showCancelButton: Bool - default true 66 | - locale: Locale? - default nil 67 | 68 | Example without 'Cancel' button: 69 | ``` swift 70 | DatePickerDialog(showCancelButton: false).show(title: "DatePicker", doneButtonTitle: "Done", datePickerMode: .date) 71 | ``` 72 | 73 | Example with custom locale: 74 | ``` swift 75 | DatePickerDialog(locale: Locale(identifier: "es_PY")).show(title: "DatePicker", doneButtonTitle: "Done", datePickerMode: .date) 76 | ``` 77 | 78 | ## Show parameters 79 | 80 | - title: String **(Required)** 81 | - doneButtonTitle: String 82 | - cancelButtonTitle: String 83 | - defaultDate: Date 84 | - minimumDate: Date 85 | - maximumDate: Date 86 | - datePickerMode: UIDatePickerMode **(Required)** 87 | - callback: ((date: Date) -> Void) **(Required)** 88 | 89 | ## Special thanks to 90 | 91 | * [@wimagguc](https://github.com/wimagguc) for the work with [ios-custom-alertview](https://github.com/wimagguc/ios-custom-alertview) library. 92 | 93 | ## License 94 | 95 | This code is distributed under the terms and conditions of the [MIT license](LICENSE). 96 | -------------------------------------------------------------------------------- /Sources/Colors.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Colors.swift 3 | // DatePickerDialog 4 | // 5 | // Created by Vini Soares on 15/10/20. 6 | // Copyright © 2020 squimer. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | 13 | internal enum Colors { 14 | 15 | static var gradientBackground: [CGColor] { 16 | if #available(iOS 13.0, *) { 17 | return [UIColor.systemGray4.cgColor, UIColor.systemGray5.cgColor, UIColor.systemGray5.cgColor] 18 | } else { 19 | return [UIColor(hexValue: 0xDADADE).cgColor, UIColor(hexValue: 0xEAEAEE).cgColor, UIColor(hexValue: 0xDADADE).cgColor] 20 | } 21 | } 22 | 23 | static var separator: UIColor { 24 | if #available(iOS 13.0, *) { 25 | return UIColor.systemGray3 26 | } else { 27 | return UIColor(hexValue: 0xD1D1D6) 28 | } 29 | } 30 | 31 | static var text: UIColor { 32 | if #available(iOS 13.0, *) { 33 | return UIColor.label 34 | } else { 35 | return UIColor(hexValue: 0x3993F8) 36 | } 37 | } 38 | 39 | static var accent: UIColor { 40 | if #available(iOS 13.0, *) { 41 | return UIColor.systemBlue 42 | } else { 43 | return UIColor(hexValue: 0x3993F8) 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Sources/DatePickerDialog.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import UIKit 3 | 4 | private extension Selector { 5 | static let buttonTapped = #selector(DatePickerDialog.buttonTapped) 6 | static let deviceOrientationDidChange = #selector(DatePickerDialog.deviceOrientationDidChange) 7 | } 8 | 9 | open class DatePickerDialog: UIView { 10 | public typealias DatePickerCallback = ( Date? ) -> Void 11 | 12 | // MARK: - Constants 13 | private let kDefaultButtonHeight: CGFloat = 50 14 | private let kDefaultButtonSpacerHeight: CGFloat = 1 15 | private let kCornerRadius: CGFloat = 7 16 | private let kDoneButtonTag: Int = 1 17 | private let kDialogWidth = 300.0 18 | private let kDialogHeight = 230.0 19 | 20 | // MARK: - Views 21 | private var dialogView: UIView! 22 | private var titleLabel: UILabel! 23 | open var datePicker: UIDatePicker! 24 | private var cancelButton: UIButton! 25 | private var doneButton: UIButton! 26 | 27 | // MARK: - Variables 28 | private var defaultDate: Date? 29 | private var datePickerMode: UIDatePicker.Mode? 30 | private var callback: DatePickerCallback? 31 | var showCancelButton: Bool = false 32 | var locale: Locale? 33 | 34 | private var textColor: UIColor! 35 | private var buttonColor: UIColor! 36 | private var font: UIFont! 37 | 38 | private var container: UIView? 39 | private lazy var gradient = CAGradientLayer(layer: self.layer) 40 | 41 | // MARK: - Dialog initialization 42 | @objc public init( 43 | textColor: UIColor? = nil, 44 | buttonColor: UIColor? = nil, 45 | font: UIFont = .boldSystemFont(ofSize: 15), 46 | locale: Locale? = nil, 47 | showCancelButton: Bool = true 48 | ) { 49 | let size = UIScreen.main.bounds.size 50 | super.init(frame: CGRect(x: 0, y: 0, width: size.width, height: size.height)) 51 | self.textColor = textColor ?? Colors.text 52 | self.buttonColor = buttonColor ?? Colors.accent 53 | self.font = font 54 | self.showCancelButton = showCancelButton 55 | self.locale = locale 56 | setupView() 57 | } 58 | 59 | @available(*, unavailable) 60 | @objc required public init?(coder aDecoder: NSCoder) { 61 | super.init(coder: aDecoder) 62 | } 63 | 64 | func setupView() { 65 | dialogView = createContainerView() 66 | 67 | dialogView?.layer.shouldRasterize = true 68 | dialogView?.layer.rasterizationScale = UIScreen.main.scale 69 | 70 | layer.shouldRasterize = true 71 | layer.rasterizationScale = UIScreen.main.scale 72 | 73 | dialogView?.layer.opacity = 0.5 74 | dialogView?.layer.transform = CATransform3DMakeScale(1.3, 1.3, 1) 75 | 76 | backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0) 77 | 78 | if let dialogView = dialogView { 79 | addSubview(dialogView) 80 | } 81 | } 82 | 83 | /// Handle device orientation changes 84 | @objc func deviceOrientationDidChange(_ notification: Notification) { 85 | self.frame = UIScreen.main.bounds 86 | let dialogSize = CGSize(width: kDialogWidth, height: kDialogHeight + kDefaultButtonHeight + kDefaultButtonSpacerHeight) 87 | dialogView.frame = CGRect( 88 | x: (UIScreen.main.bounds.size.width - dialogSize.width) / 2, 89 | y: (UIScreen.main.bounds.size.height - dialogSize.height) / 2, 90 | width: dialogSize.width, 91 | height: dialogSize.height 92 | ) 93 | } 94 | 95 | /// Create the dialog view, and animate opening the dialog 96 | open func show( 97 | _ title: String, 98 | doneButtonTitle: String = "Done", 99 | cancelButtonTitle: String = "Cancel", 100 | defaultDate: Date = Date(), 101 | minimumDate: Date? = nil, maximumDate: Date? = nil, 102 | datePickerMode: UIDatePicker.Mode = .dateAndTime, 103 | callback: @escaping DatePickerCallback 104 | ) { 105 | self.titleLabel.text = title 106 | self.doneButton.setTitle(doneButtonTitle, for: .normal) 107 | if showCancelButton { self.cancelButton.setTitle(cancelButtonTitle, for: .normal) } 108 | self.datePickerMode = datePickerMode 109 | self.callback = callback 110 | self.defaultDate = defaultDate 111 | self.datePicker.datePickerMode = self.datePickerMode ?? UIDatePicker.Mode.date 112 | self.datePicker.date = self.defaultDate ?? Date() 113 | self.datePicker.maximumDate = maximumDate 114 | self.datePicker.minimumDate = minimumDate 115 | if let locale = self.locale { self.datePicker.locale = locale } 116 | 117 | if #available(iOS 13.4, *) { datePicker.preferredDatePickerStyle = .wheels } 118 | 119 | /* Add dialog to main window */ 120 | guard let appDelegate = UIApplication.shared.delegate else { fatalError() } 121 | var window = appDelegate.window 122 | if #available(iOS 13.4, *), 123 | window == nil { 124 | // do this to compatible with Swiftui 125 | // and you should only use this approach if you app will only ever have one scene and one window. 126 | window = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.windows.first 127 | } 128 | guard let window = window else { fatalError() } 129 | window?.addSubview(self) 130 | window?.bringSubviewToFront(self) 131 | window?.endEditing(true) 132 | 133 | NotificationCenter.default.addObserver( 134 | self, 135 | selector: .deviceOrientationDidChange, 136 | name: UIDevice.orientationDidChangeNotification, object: nil 137 | ) 138 | 139 | /* Anim */ 140 | UIView.animate( 141 | withDuration: 0.2, 142 | delay: 0, 143 | options: .curveEaseInOut, 144 | animations: { 145 | self.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.4) 146 | self.dialogView?.layer.opacity = 1 147 | self.dialogView?.layer.transform = CATransform3DMakeScale(1, 1, 1) 148 | } 149 | ) 150 | } 151 | 152 | /// Dialog close animation then cleaning and removing the view from the parent 153 | private func close() { 154 | let currentTransform = self.dialogView.layer.transform 155 | 156 | let startRotation = (self.value(forKeyPath: "layer.transform.rotation.z") as? NSNumber) as? Double ?? 0.0 157 | let rotation = CATransform3DMakeRotation((CGFloat)(-startRotation + .pi * 270 / 180), 0, 0, 0) 158 | 159 | self.dialogView.layer.transform = CATransform3DConcat(rotation, CATransform3DMakeScale(1, 1, 1)) 160 | self.dialogView.layer.opacity = 1 161 | 162 | UIView.animate( 163 | withDuration: 0.2, 164 | delay: 0, 165 | options: [], 166 | animations: { 167 | self.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0) 168 | let transform = CATransform3DConcat(currentTransform, CATransform3DMakeScale(0.6, 0.6, 1)) 169 | self.dialogView.layer.transform = transform 170 | self.dialogView.layer.opacity = 0 171 | } 172 | ) { _ in 173 | for v in self.subviews { 174 | v.removeFromSuperview() 175 | } 176 | 177 | self.removeFromSuperview() 178 | self.setupView() 179 | } 180 | } 181 | 182 | /// Creates the container view here: create the dialog, then add the custom content and buttons 183 | private func createContainerView() -> UIView { 184 | let screenSize = UIScreen.main.bounds.size 185 | let dialogSize = CGSize(width: kDialogWidth, height: kDialogHeight + kDefaultButtonHeight + kDefaultButtonSpacerHeight) 186 | 187 | // For the black background 188 | self.frame = CGRect(x: 0, y: 0, width: screenSize.width, height: screenSize.height) 189 | 190 | // This is the dialog's container; we attach the custom content and the buttons to this one 191 | let container = UIView() 192 | self.container = container 193 | container.frame = CGRect( 194 | x: (screenSize.width - dialogSize.width) / 2, 195 | y: (screenSize.height - dialogSize.height) / 2, 196 | width: dialogSize.width, 197 | height: dialogSize.height 198 | ) 199 | 200 | // First, we style the dialog to match the iOS8 UIAlertView >>> 201 | gradient.frame = container.bounds 202 | gradient.colors = Colors.gradientBackground 203 | 204 | let cornerRadius = kCornerRadius 205 | gradient.cornerRadius = cornerRadius 206 | container.layer.insertSublayer(gradient, at: 0) 207 | 208 | container.layer.cornerRadius = cornerRadius 209 | container.layer.borderColor = Colors.separator.cgColor 210 | container.layer.borderWidth = 1 211 | container.layer.shadowRadius = cornerRadius + 5 212 | container.layer.shadowOpacity = 0.1 213 | container.layer.shadowOffset = CGSize(width: 0 - (cornerRadius + 5) / 2, height: 0 - (cornerRadius + 5) / 2) 214 | container.layer.shadowColor = UIColor.black.cgColor 215 | container.layer.shadowPath = UIBezierPath( 216 | roundedRect: container.bounds, 217 | cornerRadius: container.layer.cornerRadius 218 | ).cgPath 219 | 220 | // There is a line above the button 221 | let yPosition = container.bounds.size.height - kDefaultButtonHeight - kDefaultButtonSpacerHeight 222 | let lineView = UIView(frame: CGRect( 223 | x: 0, 224 | y: yPosition, 225 | width: container.bounds.size.width, 226 | height: kDefaultButtonSpacerHeight 227 | )) 228 | 229 | lineView.backgroundColor = Colors.separator 230 | container.addSubview(lineView) 231 | 232 | //Title 233 | self.titleLabel = UILabel(frame: CGRect(x: 10, y: 10, width: 280, height: 30)) 234 | self.titleLabel.textAlignment = .center 235 | self.titleLabel.textColor = self.textColor 236 | self.titleLabel.font = self.font.withSize(17) 237 | container.addSubview(self.titleLabel) 238 | 239 | self.datePicker = configuredDatePicker() 240 | container.addSubview(self.datePicker) 241 | 242 | // Add the buttons 243 | addButtonsToView(container: container) 244 | 245 | return container 246 | } 247 | 248 | fileprivate func configuredDatePicker() -> UIDatePicker { 249 | let datePicker = UIDatePicker(frame: CGRect(x: 0, y: 30, width: 0, height: 0)) 250 | datePicker.setValue(self.textColor, forKeyPath: "textColor") 251 | datePicker.autoresizingMask = .flexibleRightMargin 252 | datePicker.frame.size.width = kDialogWidth 253 | datePicker.frame.size.height = 216 254 | return datePicker 255 | } 256 | 257 | /// Add buttons to container 258 | private func addButtonsToView(container: UIView) { 259 | var buttonWidth = container.bounds.size.width / 2 260 | 261 | var leftButtonFrame = CGRect( 262 | x: 0, 263 | y: container.bounds.size.height - kDefaultButtonHeight, 264 | width: buttonWidth, 265 | height: kDefaultButtonHeight 266 | ) 267 | var rightButtonFrame = CGRect( 268 | x: buttonWidth, 269 | y: container.bounds.size.height - kDefaultButtonHeight, 270 | width: buttonWidth, 271 | height: kDefaultButtonHeight 272 | ) 273 | if showCancelButton == false { 274 | buttonWidth = container.bounds.size.width 275 | leftButtonFrame = CGRect() 276 | rightButtonFrame = CGRect( 277 | x: 0, 278 | y: container.bounds.size.height - kDefaultButtonHeight, 279 | width: buttonWidth, 280 | height: kDefaultButtonHeight 281 | ) 282 | } 283 | let interfaceLayoutDirection = UIApplication.shared.userInterfaceLayoutDirection 284 | let isLeftToRightDirection = interfaceLayoutDirection == .leftToRight 285 | 286 | if showCancelButton { 287 | self.cancelButton = UIButton(type: .system) 288 | self.cancelButton.frame = isLeftToRightDirection ? leftButtonFrame : rightButtonFrame 289 | self.cancelButton.setTitleColor(self.buttonColor, for: .normal) 290 | self.cancelButton.setTitleColor(self.buttonColor, for: .highlighted) 291 | self.cancelButton.titleLabel?.font = self.font.withSize(14) 292 | self.cancelButton.layer.cornerRadius = kCornerRadius 293 | self.cancelButton.addTarget(self, action: .buttonTapped, for: .touchUpInside) 294 | container.addSubview(self.cancelButton) 295 | } 296 | 297 | self.doneButton = UIButton(type: .system) 298 | self.doneButton.frame = isLeftToRightDirection ? rightButtonFrame : leftButtonFrame 299 | self.doneButton.tag = kDoneButtonTag 300 | self.doneButton.setTitleColor(self.buttonColor, for: .normal) 301 | self.doneButton.setTitleColor(self.buttonColor, for: .highlighted) 302 | self.doneButton.titleLabel?.font = self.font.withSize(14) 303 | self.doneButton.layer.cornerRadius = kCornerRadius 304 | self.doneButton.addTarget(self, action: .buttonTapped, for: .touchUpInside) 305 | container.addSubview(self.doneButton) 306 | } 307 | 308 | @objc func buttonTapped(sender: UIButton) { 309 | if sender.tag == kDoneButtonTag { 310 | self.callback?(self.datePicker.date) 311 | } else { 312 | self.callback?(nil) 313 | } 314 | 315 | close() 316 | } 317 | 318 | deinit { 319 | NotificationCenter.default.removeObserver(self) 320 | } 321 | 322 | open override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { 323 | super.traitCollectionDidChange(previousTraitCollection) 324 | container?.layer.borderColor = Colors.separator.cgColor 325 | gradient.colors = Colors.gradientBackground 326 | } 327 | } 328 | -------------------------------------------------------------------------------- /Sources/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 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/UIColor+Ext.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+Ext.swift 3 | // DatePickerDialog 4 | // 5 | // Created by Vini Soares on 15/10/20. 6 | // Copyright © 2020 squimer. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | internal extension UIColor { 12 | convenience init(red: Int, green: Int, blue: Int, a: CGFloat = 1.0) { 13 | self.init( 14 | red: CGFloat(red) / 255.0, 15 | green: CGFloat(green) / 255.0, 16 | blue: CGFloat(blue) / 255.0, 17 | alpha: a 18 | ) 19 | } 20 | 21 | convenience init(hexValue: Int, a: CGFloat = 1.0) { 22 | self.init( 23 | red: (hexValue >> 16) & 0xFF, 24 | green: (hexValue >> 8) & 0xFF, 25 | blue: hexValue & 0xFF, 26 | a: a 27 | ) 28 | } 29 | 30 | static func adaptive(dark: UIColor, light: UIColor) -> UIColor { 31 | if #available(iOS 13.0, *) { 32 | return UIColor { $0.userInterfaceStyle == .dark ? dark : light } 33 | } else { 34 | return light 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Tests/DatePickerDialogTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import DatePickerDialog 3 | 4 | class DatePickerDialogTests: XCTestCase { 5 | override func setUp() { 6 | super.setUp() 7 | // Put setup code here. This method is called before the invocation of each test method in the class. 8 | } 9 | 10 | override func tearDown() { 11 | // Put teardown code here. This method is called after the invocation of each test method in the class. 12 | super.tearDown() 13 | } 14 | 15 | func testExample() { 16 | // This is an example of a functional test case. 17 | // Use XCTAssert and related functions to verify your tests produce the correct results. 18 | } 19 | 20 | func testPerformanceExample() { 21 | // This is an example of a performance test case. 22 | self.measure { 23 | // Put the code you want to measure the time of here. 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Tests/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 | -------------------------------------------------------------------------------- /images/screen1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/squimer/DatePickerDialog-iOS-Swift/184b3fcc0da5284375ba2f983138c14f7dfae6f7/images/screen1.png --------------------------------------------------------------------------------