├── .gitattributes ├── .gitignore ├── .travis.yml ├── CRTimePicker.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── CRTimePicker ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── CRHourCell.swift ├── CRMinuteCell.swift ├── CRTimePickerViewController.swift └── Info.plist ├── CRTimePickerTests ├── CRTimePickerTests.swift └── Info.plist ├── LICENSE ├── README.md └── README └── ui.jpg /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj binary merge=union -------------------------------------------------------------------------------- /.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 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | oxc_image: xcode8 2 | language: objective-c 3 | xcode-project: CRTimePicker.xcworkspace 4 | xcode_scheme: CRTimePicker 5 | xcode_sdk: iphonesimulator8.4 6 | script: 7 | - xcodebuild -scheme 'CRTimePicker-iOS' -sdk iphonesimulator CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO test | xcpretty -c 8 | - xcodebuild -scheme 'CRTimePicker-OSX' test | xcpretty -c -------------------------------------------------------------------------------- /CRTimePicker.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4C86486D1E863AC4007AC636 /* CRTimePickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C86486C1E863AC4007AC636 /* CRTimePickerViewController.swift */; }; 11 | 4C86486F1E86495C007AC636 /* CRHourCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C86486E1E86495C007AC636 /* CRHourCell.swift */; }; 12 | 4C8648711E864FCB007AC636 /* CRMinuteCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8648701E864FCB007AC636 /* CRMinuteCell.swift */; }; 13 | 4CAAA6061E8638B000927DB9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CAAA6051E8638B000927DB9 /* AppDelegate.swift */; }; 14 | 4CAAA60B1E8638B000927DB9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4CAAA6091E8638B000927DB9 /* Main.storyboard */; }; 15 | 4CAAA60D1E8638B000927DB9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4CAAA60C1E8638B000927DB9 /* Assets.xcassets */; }; 16 | 4CAAA6101E8638B000927DB9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4CAAA60E1E8638B000927DB9 /* LaunchScreen.storyboard */; }; 17 | 4CAAA61B1E8638B000927DB9 /* CRTimePickerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CAAA61A1E8638B000927DB9 /* CRTimePickerTests.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 4CAAA6171E8638B000927DB9 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 4CAAA5FA1E8638B000927DB9 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 4CAAA6011E8638B000927DB9; 26 | remoteInfo = CRTimePicker; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 4C86486C1E863AC4007AC636 /* CRTimePickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRTimePickerViewController.swift; sourceTree = ""; }; 32 | 4C86486E1E86495C007AC636 /* CRHourCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRHourCell.swift; sourceTree = ""; }; 33 | 4C8648701E864FCB007AC636 /* CRMinuteCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRMinuteCell.swift; sourceTree = ""; }; 34 | 4CAAA6021E8638B000927DB9 /* CRTimePicker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CRTimePicker.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 4CAAA6051E8638B000927DB9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 36 | 4CAAA60A1E8638B000927DB9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | 4CAAA60C1E8638B000927DB9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 38 | 4CAAA60F1E8638B000927DB9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 39 | 4CAAA6111E8638B000927DB9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 4CAAA6161E8638B000927DB9 /* CRTimePickerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CRTimePickerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 4CAAA61A1E8638B000927DB9 /* CRTimePickerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CRTimePickerTests.swift; sourceTree = ""; }; 42 | 4CAAA61C1E8638B000927DB9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 4CAAA5FF1E8638B000927DB9 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | 4CAAA6131E8638B000927DB9 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | 4CAAA5F91E8638B000927DB9 = { 64 | isa = PBXGroup; 65 | children = ( 66 | 4CAAA6041E8638B000927DB9 /* CRTimePicker */, 67 | 4CAAA6191E8638B000927DB9 /* CRTimePickerTests */, 68 | 4CAAA6031E8638B000927DB9 /* Products */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | 4CAAA6031E8638B000927DB9 /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 4CAAA6021E8638B000927DB9 /* CRTimePicker.app */, 76 | 4CAAA6161E8638B000927DB9 /* CRTimePickerTests.xctest */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | 4CAAA6041E8638B000927DB9 /* CRTimePicker */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 4CAAA6051E8638B000927DB9 /* AppDelegate.swift */, 85 | 4C86486C1E863AC4007AC636 /* CRTimePickerViewController.swift */, 86 | 4C86486E1E86495C007AC636 /* CRHourCell.swift */, 87 | 4C8648701E864FCB007AC636 /* CRMinuteCell.swift */, 88 | 4CAAA6091E8638B000927DB9 /* Main.storyboard */, 89 | 4CAAA60C1E8638B000927DB9 /* Assets.xcassets */, 90 | 4CAAA60E1E8638B000927DB9 /* LaunchScreen.storyboard */, 91 | 4CAAA6111E8638B000927DB9 /* Info.plist */, 92 | ); 93 | path = CRTimePicker; 94 | sourceTree = ""; 95 | }; 96 | 4CAAA6191E8638B000927DB9 /* CRTimePickerTests */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 4CAAA61A1E8638B000927DB9 /* CRTimePickerTests.swift */, 100 | 4CAAA61C1E8638B000927DB9 /* Info.plist */, 101 | ); 102 | path = CRTimePickerTests; 103 | sourceTree = ""; 104 | }; 105 | /* End PBXGroup section */ 106 | 107 | /* Begin PBXNativeTarget section */ 108 | 4CAAA6011E8638B000927DB9 /* CRTimePicker */ = { 109 | isa = PBXNativeTarget; 110 | buildConfigurationList = 4CAAA61F1E8638B000927DB9 /* Build configuration list for PBXNativeTarget "CRTimePicker" */; 111 | buildPhases = ( 112 | 4CAAA5FE1E8638B000927DB9 /* Sources */, 113 | 4CAAA5FF1E8638B000927DB9 /* Frameworks */, 114 | 4CAAA6001E8638B000927DB9 /* Resources */, 115 | ); 116 | buildRules = ( 117 | ); 118 | dependencies = ( 119 | ); 120 | name = CRTimePicker; 121 | productName = CRTimePicker; 122 | productReference = 4CAAA6021E8638B000927DB9 /* CRTimePicker.app */; 123 | productType = "com.apple.product-type.application"; 124 | }; 125 | 4CAAA6151E8638B000927DB9 /* CRTimePickerTests */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 4CAAA6221E8638B000927DB9 /* Build configuration list for PBXNativeTarget "CRTimePickerTests" */; 128 | buildPhases = ( 129 | 4CAAA6121E8638B000927DB9 /* Sources */, 130 | 4CAAA6131E8638B000927DB9 /* Frameworks */, 131 | 4CAAA6141E8638B000927DB9 /* Resources */, 132 | ); 133 | buildRules = ( 134 | ); 135 | dependencies = ( 136 | 4CAAA6181E8638B000927DB9 /* PBXTargetDependency */, 137 | ); 138 | name = CRTimePickerTests; 139 | productName = CRTimePickerTests; 140 | productReference = 4CAAA6161E8638B000927DB9 /* CRTimePickerTests.xctest */; 141 | productType = "com.apple.product-type.bundle.unit-test"; 142 | }; 143 | /* End PBXNativeTarget section */ 144 | 145 | /* Begin PBXProject section */ 146 | 4CAAA5FA1E8638B000927DB9 /* Project object */ = { 147 | isa = PBXProject; 148 | attributes = { 149 | LastSwiftUpdateCheck = 0820; 150 | LastUpgradeCheck = 0820; 151 | ORGANIZATIONNAME = cruz; 152 | TargetAttributes = { 153 | 4CAAA6011E8638B000927DB9 = { 154 | CreatedOnToolsVersion = 8.2.1; 155 | ProvisioningStyle = Automatic; 156 | }; 157 | 4CAAA6151E8638B000927DB9 = { 158 | CreatedOnToolsVersion = 8.2.1; 159 | ProvisioningStyle = Automatic; 160 | TestTargetID = 4CAAA6011E8638B000927DB9; 161 | }; 162 | }; 163 | }; 164 | buildConfigurationList = 4CAAA5FD1E8638B000927DB9 /* Build configuration list for PBXProject "CRTimePicker" */; 165 | compatibilityVersion = "Xcode 3.2"; 166 | developmentRegion = English; 167 | hasScannedForEncodings = 0; 168 | knownRegions = ( 169 | en, 170 | Base, 171 | ); 172 | mainGroup = 4CAAA5F91E8638B000927DB9; 173 | productRefGroup = 4CAAA6031E8638B000927DB9 /* Products */; 174 | projectDirPath = ""; 175 | projectRoot = ""; 176 | targets = ( 177 | 4CAAA6011E8638B000927DB9 /* CRTimePicker */, 178 | 4CAAA6151E8638B000927DB9 /* CRTimePickerTests */, 179 | ); 180 | }; 181 | /* End PBXProject section */ 182 | 183 | /* Begin PBXResourcesBuildPhase section */ 184 | 4CAAA6001E8638B000927DB9 /* Resources */ = { 185 | isa = PBXResourcesBuildPhase; 186 | buildActionMask = 2147483647; 187 | files = ( 188 | 4CAAA6101E8638B000927DB9 /* LaunchScreen.storyboard in Resources */, 189 | 4CAAA60D1E8638B000927DB9 /* Assets.xcassets in Resources */, 190 | 4CAAA60B1E8638B000927DB9 /* Main.storyboard in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | 4CAAA6141E8638B000927DB9 /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | }; 201 | /* End PBXResourcesBuildPhase section */ 202 | 203 | /* Begin PBXSourcesBuildPhase section */ 204 | 4CAAA5FE1E8638B000927DB9 /* Sources */ = { 205 | isa = PBXSourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | 4C8648711E864FCB007AC636 /* CRMinuteCell.swift in Sources */, 209 | 4C86486D1E863AC4007AC636 /* CRTimePickerViewController.swift in Sources */, 210 | 4CAAA6061E8638B000927DB9 /* AppDelegate.swift in Sources */, 211 | 4C86486F1E86495C007AC636 /* CRHourCell.swift in Sources */, 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | }; 215 | 4CAAA6121E8638B000927DB9 /* Sources */ = { 216 | isa = PBXSourcesBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | 4CAAA61B1E8638B000927DB9 /* CRTimePickerTests.swift in Sources */, 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | }; 223 | /* End PBXSourcesBuildPhase section */ 224 | 225 | /* Begin PBXTargetDependency section */ 226 | 4CAAA6181E8638B000927DB9 /* PBXTargetDependency */ = { 227 | isa = PBXTargetDependency; 228 | target = 4CAAA6011E8638B000927DB9 /* CRTimePicker */; 229 | targetProxy = 4CAAA6171E8638B000927DB9 /* PBXContainerItemProxy */; 230 | }; 231 | /* End PBXTargetDependency section */ 232 | 233 | /* Begin PBXVariantGroup section */ 234 | 4CAAA6091E8638B000927DB9 /* Main.storyboard */ = { 235 | isa = PBXVariantGroup; 236 | children = ( 237 | 4CAAA60A1E8638B000927DB9 /* Base */, 238 | ); 239 | name = Main.storyboard; 240 | sourceTree = ""; 241 | }; 242 | 4CAAA60E1E8638B000927DB9 /* LaunchScreen.storyboard */ = { 243 | isa = PBXVariantGroup; 244 | children = ( 245 | 4CAAA60F1E8638B000927DB9 /* Base */, 246 | ); 247 | name = LaunchScreen.storyboard; 248 | sourceTree = ""; 249 | }; 250 | /* End PBXVariantGroup section */ 251 | 252 | /* Begin XCBuildConfiguration section */ 253 | 4CAAA61D1E8638B000927DB9 /* Debug */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | ALWAYS_SEARCH_USER_PATHS = NO; 257 | CLANG_ANALYZER_NONNULL = YES; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 266 | CLANG_WARN_EMPTY_BODY = YES; 267 | CLANG_WARN_ENUM_CONVERSION = YES; 268 | CLANG_WARN_INFINITE_RECURSION = YES; 269 | CLANG_WARN_INT_CONVERSION = YES; 270 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 271 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 272 | CLANG_WARN_UNREACHABLE_CODE = YES; 273 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 274 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 275 | COPY_PHASE_STRIP = NO; 276 | DEBUG_INFORMATION_FORMAT = dwarf; 277 | ENABLE_STRICT_OBJC_MSGSEND = YES; 278 | ENABLE_TESTABILITY = YES; 279 | GCC_C_LANGUAGE_STANDARD = gnu99; 280 | GCC_DYNAMIC_NO_PIC = NO; 281 | GCC_NO_COMMON_BLOCKS = YES; 282 | GCC_OPTIMIZATION_LEVEL = 0; 283 | GCC_PREPROCESSOR_DEFINITIONS = ( 284 | "DEBUG=1", 285 | "$(inherited)", 286 | ); 287 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 288 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 289 | GCC_WARN_UNDECLARED_SELECTOR = YES; 290 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 291 | GCC_WARN_UNUSED_FUNCTION = YES; 292 | GCC_WARN_UNUSED_VARIABLE = YES; 293 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 294 | MTL_ENABLE_DEBUG_INFO = YES; 295 | ONLY_ACTIVE_ARCH = YES; 296 | SDKROOT = iphoneos; 297 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 298 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 299 | }; 300 | name = Debug; 301 | }; 302 | 4CAAA61E1E8638B000927DB9 /* Release */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_ANALYZER_NONNULL = YES; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_WARN_BOOL_CONVERSION = YES; 312 | CLANG_WARN_CONSTANT_CONVERSION = YES; 313 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 314 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 315 | CLANG_WARN_EMPTY_BODY = YES; 316 | CLANG_WARN_ENUM_CONVERSION = YES; 317 | CLANG_WARN_INFINITE_RECURSION = YES; 318 | CLANG_WARN_INT_CONVERSION = YES; 319 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 320 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 321 | CLANG_WARN_UNREACHABLE_CODE = YES; 322 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 323 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 324 | COPY_PHASE_STRIP = NO; 325 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 326 | ENABLE_NS_ASSERTIONS = NO; 327 | ENABLE_STRICT_OBJC_MSGSEND = YES; 328 | GCC_C_LANGUAGE_STANDARD = gnu99; 329 | GCC_NO_COMMON_BLOCKS = YES; 330 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 331 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 332 | GCC_WARN_UNDECLARED_SELECTOR = YES; 333 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 334 | GCC_WARN_UNUSED_FUNCTION = YES; 335 | GCC_WARN_UNUSED_VARIABLE = YES; 336 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 337 | MTL_ENABLE_DEBUG_INFO = NO; 338 | SDKROOT = iphoneos; 339 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 340 | VALIDATE_PRODUCT = YES; 341 | }; 342 | name = Release; 343 | }; 344 | 4CAAA6201E8638B000927DB9 /* Debug */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 348 | DEVELOPMENT_TEAM = ""; 349 | INFOPLIST_FILE = CRTimePicker/Info.plist; 350 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 351 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 352 | PRODUCT_BUNDLE_IDENTIFIER = cruz.CRTimePicker; 353 | PRODUCT_NAME = "$(TARGET_NAME)"; 354 | SWIFT_VERSION = 3.0; 355 | }; 356 | name = Debug; 357 | }; 358 | 4CAAA6211E8638B000927DB9 /* Release */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 362 | DEVELOPMENT_TEAM = ""; 363 | INFOPLIST_FILE = CRTimePicker/Info.plist; 364 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 365 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 366 | PRODUCT_BUNDLE_IDENTIFIER = cruz.CRTimePicker; 367 | PRODUCT_NAME = "$(TARGET_NAME)"; 368 | SWIFT_VERSION = 3.0; 369 | }; 370 | name = Release; 371 | }; 372 | 4CAAA6231E8638B000927DB9 /* Debug */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 376 | BUNDLE_LOADER = "$(TEST_HOST)"; 377 | DEVELOPMENT_TEAM = ""; 378 | INFOPLIST_FILE = CRTimePickerTests/Info.plist; 379 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 380 | PRODUCT_BUNDLE_IDENTIFIER = cruz.CRTimePickerTests; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | SWIFT_VERSION = 3.0; 383 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CRTimePicker.app/CRTimePicker"; 384 | }; 385 | name = Debug; 386 | }; 387 | 4CAAA6241E8638B000927DB9 /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 391 | BUNDLE_LOADER = "$(TEST_HOST)"; 392 | DEVELOPMENT_TEAM = ""; 393 | INFOPLIST_FILE = CRTimePickerTests/Info.plist; 394 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 395 | PRODUCT_BUNDLE_IDENTIFIER = cruz.CRTimePickerTests; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | SWIFT_VERSION = 3.0; 398 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CRTimePicker.app/CRTimePicker"; 399 | }; 400 | name = Release; 401 | }; 402 | /* End XCBuildConfiguration section */ 403 | 404 | /* Begin XCConfigurationList section */ 405 | 4CAAA5FD1E8638B000927DB9 /* Build configuration list for PBXProject "CRTimePicker" */ = { 406 | isa = XCConfigurationList; 407 | buildConfigurations = ( 408 | 4CAAA61D1E8638B000927DB9 /* Debug */, 409 | 4CAAA61E1E8638B000927DB9 /* Release */, 410 | ); 411 | defaultConfigurationIsVisible = 0; 412 | defaultConfigurationName = Release; 413 | }; 414 | 4CAAA61F1E8638B000927DB9 /* Build configuration list for PBXNativeTarget "CRTimePicker" */ = { 415 | isa = XCConfigurationList; 416 | buildConfigurations = ( 417 | 4CAAA6201E8638B000927DB9 /* Debug */, 418 | 4CAAA6211E8638B000927DB9 /* Release */, 419 | ); 420 | defaultConfigurationIsVisible = 0; 421 | defaultConfigurationName = Release; 422 | }; 423 | 4CAAA6221E8638B000927DB9 /* Build configuration list for PBXNativeTarget "CRTimePickerTests" */ = { 424 | isa = XCConfigurationList; 425 | buildConfigurations = ( 426 | 4CAAA6231E8638B000927DB9 /* Debug */, 427 | 4CAAA6241E8638B000927DB9 /* Release */, 428 | ); 429 | defaultConfigurationIsVisible = 0; 430 | defaultConfigurationName = Release; 431 | }; 432 | /* End XCConfigurationList section */ 433 | }; 434 | rootObject = 4CAAA5FA1E8638B000927DB9 /* Project object */; 435 | } 436 | -------------------------------------------------------------------------------- /CRTimePicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CRTimePicker/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CRTimePicker 4 | // 5 | // Created by Cruz on 25/03/2017. 6 | // Copyright © 2017 cruz. 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 | -------------------------------------------------------------------------------- /CRTimePicker/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 | } -------------------------------------------------------------------------------- /CRTimePicker/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 | -------------------------------------------------------------------------------- /CRTimePicker/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 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 74 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 151 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | -------------------------------------------------------------------------------- /CRTimePicker/CRHourCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CRHourCell.swift 3 | // CRTimePicker 4 | // 5 | // Created by CruzDiary on 25/03/2017. 6 | // Copyright © 2017 cruz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CRHourCell: UITableViewCell { 12 | 13 | @IBOutlet weak var hourLabel: UILabel! 14 | override func awakeFromNib() { 15 | super.awakeFromNib() 16 | // Initialization code 17 | } 18 | 19 | override func setSelected(_ selected: Bool, animated: Bool) { 20 | super.setSelected(selected, animated: animated) 21 | 22 | // Configure the view for the selected state 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /CRTimePicker/CRMinuteCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CRMinuteCell.swift 3 | // CRTimePicker 4 | // 5 | // Created by CruzDiary on 25/03/2017. 6 | // Copyright © 2017 cruz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CRMinuteCell: UITableViewCell { 12 | 13 | @IBOutlet weak var minuteLabel: UILabel! 14 | override func awakeFromNib() { 15 | super.awakeFromNib() 16 | // Initialization code 17 | } 18 | 19 | override func setSelected(_ selected: Bool, animated: Bool) { 20 | super.setSelected(selected, animated: animated) 21 | 22 | // Configure the view for the selected state 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /CRTimePicker/CRTimePickerViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CRTimePickerViewController.swift 3 | // CRTimePicker 4 | // 5 | // Created by Cruz on 25/03/2017. 6 | // Copyright © 2017 cruz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol CRTimePickerDelegate: class { 12 | func timeDidSelect(hour: Int, minute: Int) 13 | } 14 | 15 | class CRTimePickerViewController: UIViewController { 16 | 17 | weak var delegate: CRTimePickerDelegate? 18 | 19 | @IBOutlet weak var hourContainerView: UIView! 20 | @IBOutlet weak var hourView: UIView! 21 | @IBOutlet weak var hourLabel: UILabel! 22 | @IBOutlet weak var hourTableView: UITableView! 23 | 24 | @IBOutlet weak var minuteContainerView: UIView! 25 | @IBOutlet weak var minuteView: UIView! 26 | @IBOutlet weak var minuteLabel: UILabel! 27 | @IBOutlet weak var minuteTableView: UITableView! 28 | 29 | @IBAction func doneButtonDidTap(_ sender: UIButton) { 30 | delegate?.timeDidSelect(hour: hour, minute: minute) 31 | } 32 | 33 | var hour: Int = 0 34 | var minute: Int = 0 35 | 36 | override func viewDidLoad() { 37 | super.viewDidLoad() 38 | 39 | hourContainerView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(gesture))) 40 | hourContainerView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(gesture))) 41 | 42 | minuteContainerView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(gesture))) 43 | minuteContainerView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(gesture))) 44 | // Do any additional setup after loading the view. 45 | } 46 | 47 | func gesture(gesture: UIGestureRecognizer) { 48 | guard let view = gesture.view else { return } 49 | switch view { 50 | case hourContainerView: 51 | var point = gesture.location(in: hourContainerView) 52 | point.x = hourView.center.x 53 | point.y = min(max(point.y, 30), view.frame.size.height - 30) 54 | 55 | if let indexPath = hourTableView.indexPathForRow(at: point) { 56 | hour = indexPath.row + 1 57 | hourLabel.text = String(format: "%02lu", hour) 58 | } 59 | 60 | UIView.animate(withDuration: 0.1) { 61 | self.hourView.center = point 62 | } 63 | case minuteContainerView: 64 | var point = gesture.location(in: minuteContainerView) 65 | point.x = minuteView.center.x 66 | point.y = min(max(point.y, 30), view.frame.size.height - 30) 67 | 68 | if let indexPath = hourTableView.indexPathForRow(at: point) { 69 | minute = indexPath.row * 5 70 | minuteLabel.text = String(format: "%02lu", minute) 71 | } 72 | 73 | UIView.animate(withDuration: 0.1) { 74 | self.minuteView.center = point 75 | } 76 | default: break 77 | } 78 | } 79 | 80 | override func didReceiveMemoryWarning() { 81 | super.didReceiveMemoryWarning() 82 | // Dispose of any resources that can be recreated. 83 | } 84 | 85 | 86 | /* 87 | // MARK: - Navigation 88 | 89 | // In a storyboard-based application, you will often want to do a little preparation before navigation 90 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 91 | // Get the new view controller using segue.destinationViewController. 92 | // Pass the selected object to the new view controller. 93 | } 94 | */ 95 | 96 | } 97 | 98 | extension CRTimePickerViewController: UITableViewDataSource { 99 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 100 | switch tableView { 101 | case hourTableView: 102 | let cell = tableView.dequeueReusableCell(withIdentifier: "CRHourCell", for: indexPath) as! CRHourCell 103 | cell.hourLabel.text = String(format: "%02lu", indexPath.row + 1) 104 | return cell 105 | default: 106 | let cell = tableView.dequeueReusableCell(withIdentifier: "CRMinuteCell", for: indexPath) as! CRMinuteCell 107 | cell.minuteLabel.text = String(format: "%02lu", indexPath.row * 5) 108 | return cell 109 | } 110 | } 111 | 112 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 113 | return 12 114 | } 115 | 116 | } 117 | 118 | extension CRTimePickerViewController: UITableViewDelegate { 119 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 120 | return tableView.frame.size.height / 12 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /CRTimePicker/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 | -------------------------------------------------------------------------------- /CRTimePickerTests/CRTimePickerTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CRTimePickerTests.swift 3 | // CRTimePickerTests 4 | // 5 | // Created by CruzDiary on 25/03/2017. 6 | // Copyright © 2017 cruz. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import CRTimePicker 11 | 12 | class CRTimePickerTests: 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 | -------------------------------------------------------------------------------- /CRTimePickerTests/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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Cruz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CRTimePicker 2 | Time Picker 3 | 4 | ![logo](README/ui.jpg) 5 | Timer by @bassi_renata | Found on @dribbble⠀ 6 | -------------------------------------------------------------------------------- /README/ui.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cruisediary/CRTimePicker/f1eb54695b7d171a860dfb66c0cb37e8b7ec03ed/README/ui.jpg --------------------------------------------------------------------------------