├── .gitignore ├── .swift-version ├── .travis.yml ├── Elapse.podspec ├── Elapse.xcodeproj ├── ElapseTests_Info.plist ├── Elapse_Info.plist ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── Elapse_iOS.xcscheme │ ├── Elapse_macOS.xcscheme │ ├── Elapse_tvOS.xcscheme │ ├── Elapse_watchOS.xcscheme │ └── xcschememanagement.plist ├── LICENSE ├── Package.swift ├── README.md ├── Sources └── Elapse.swift └── Tests ├── ElapseTests └── ElapseTests.swift └── LinuxMain.swift /.gitignore: -------------------------------------------------------------------------------- 1 | #### joe made this: http://goel.io/joe 2 | 3 | #### macos #### 4 | *.DS_Store 5 | .AppleDouble 6 | .LSOverride 7 | 8 | # Icon must end with two \r 9 | Icon 10 | 11 | # Thumbnails 12 | ._* 13 | 14 | # Files that might appear in the root of a volume 15 | .DocumentRevisions-V100 16 | .fseventsd 17 | .Spotlight-V100 18 | .TemporaryItems 19 | .Trashes 20 | .VolumeIcon.icns 21 | .com.apple.timemachine.donotpresent 22 | 23 | # Directories potentially created on remote AFP share 24 | .AppleDB 25 | .AppleDesktop 26 | Network Trash Folder 27 | Temporary Items 28 | .apdisk 29 | 30 | 31 | #### swift #### 32 | # Xcode 33 | # 34 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 35 | 36 | ## Build generated 37 | build/ 38 | DerivedData/ 39 | 40 | ## Various settings 41 | *.pbxuser 42 | !default.pbxuser 43 | *.mode1v3 44 | !default.mode1v3 45 | *.mode2v3 46 | !default.mode2v3 47 | *.perspectivev3 48 | !default.perspectivev3 49 | xcuserdata/ 50 | 51 | ## Other 52 | *.moved-aside 53 | *.xccheckout 54 | *.xcscmblueprint 55 | 56 | ## Obj-C/Swift specific 57 | *.hmap 58 | *.ipa 59 | *.dSYM.zip 60 | *.dSYM 61 | 62 | ## Playgrounds 63 | timeline.xctimeline 64 | playground.xcworkspace 65 | 66 | # Swift Package Manager 67 | # 68 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 69 | Packages/ 70 | Package.pins 71 | .build/ 72 | 73 | # CocoaPods 74 | # 75 | # We recommend against adding the Pods directory to your .gitignore. However 76 | # you should judge for yourself, the pros and cons are mentioned at: 77 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 78 | # 79 | Pods/ 80 | 81 | # Carthage 82 | # 83 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 84 | # Carthage/Checkouts 85 | 86 | Carthage/Build 87 | 88 | # fastlane 89 | # 90 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 91 | # screenshots whenever they are needed. 92 | # For more information about the recommended setup visit: 93 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 94 | 95 | fastlane/report.xml 96 | fastlane/Preview.html 97 | fastlane/screenshots 98 | fastlane/test_output 99 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.2 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode10 3 | xcode_project: Elapse.xcodeproj # path to your xcodeproj folder 4 | xcode_scheme: ElapseTests 5 | xcode_sdk: iphonesimulator 6 | 7 | script: 8 | - pod lib lint --allow-warnings 9 | - xcodebuild clean test -scheme Elapse_macOS -configuration Debug -destination 'platform=OS X' 10 | - xcodebuild clean test -scheme Elapse_iOS -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 8,OS=12.0' 11 | - xcodebuild clean test -scheme Elapse_tvOS -configuration Debug -destination 'platform=tvOS Simulator,name=Apple TV 4K,OS=12.0' 12 | -------------------------------------------------------------------------------- /Elapse.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint Elapse.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "Elapse" 19 | s.version = "1.1.0" 20 | s.summary = "TimeInterval manipulating library" 21 | s.swift_version = "4.2" 22 | 23 | # This description is used to generate tags and improve search results. 24 | # * Think: What does it do? Why did you write it? What is the focus? 25 | # * Try to keep it short, snappy and to the point. 26 | # * Write the description between the DESC delimiters below. 27 | # * Finally, don't worry about the indent, CocoaPods strips it! 28 | s.description = <<-DESC 29 | Elapse is tiny helper library for manipulating TimeInterval. 30 | DESC 31 | 32 | s.homepage = "https://github.com/yshrkt/Elapse" 33 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 34 | 35 | 36 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 37 | # 38 | # Licensing your code is important. See http://choosealicense.com for more info. 39 | # CocoaPods will detect a license file if there is a named LICENSE* 40 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 41 | # 42 | 43 | s.license = "MIT" 44 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 45 | 46 | 47 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 48 | # 49 | # Specify the authors of the library, with email addresses. Email addresses 50 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 51 | # accepts just a name if you'd rather not provide an email address. 52 | # 53 | # Specify a social_media_url where others can refer to, for example a twitter 54 | # profile URL. 55 | # 56 | 57 | s.author = { "Yoshihiro Kato" => "yoshihiro@sputnik-apps.com" } 58 | # Or just: s.author = "Yoshihiro Kato" 59 | # s.authors = { "Yoshihiro Kato" => "yoshihiro@sputnik-apps.com" } 60 | # s.social_media_url = "http://twitter.com/Yoshihiro Kato" 61 | 62 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 63 | # 64 | # If this Pod runs only on iOS or OS X, then specify the platform and 65 | # the deployment target. You can optionally include the target after the platform. 66 | # 67 | 68 | # s.platform = :ios 69 | # s.platform = :ios, "5.0" 70 | 71 | # When using multiple platforms 72 | s.ios.deployment_target = '10.3' 73 | s.osx.deployment_target = '10.10' 74 | s.watchos.deployment_target = '3.2' 75 | s.tvos.deployment_target = '10.2' 76 | 77 | 78 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 79 | # 80 | # Specify the location from where the source should be retrieved. 81 | # Supports git, hg, bzr, svn and HTTP. 82 | # 83 | 84 | s.source = { :git => "https://github.com/yshrkt/Elapse.git", :tag => "#{s.version}" } 85 | 86 | 87 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 88 | # 89 | # CocoaPods is smart about how it includes source code. For source files 90 | # giving a folder will include any swift, h, m, mm, c & cpp files. 91 | # For header files it will include any header in the folder. 92 | # Not including the public_header_files will make all headers public. 93 | # 94 | 95 | s.source_files = "Sources/*.{swift}" 96 | #s.exclude_files = "Classes/Exclude" 97 | 98 | # s.public_header_files = "Classes/**/*.h" 99 | 100 | 101 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 102 | # 103 | # A list of resources included with the Pod. These are copied into the 104 | # target bundle with a build phase script. Anything else will be cleaned. 105 | # You can preserve files from being cleaned, please don't preserve 106 | # non-essential files like tests, examples and documentation. 107 | # 108 | 109 | # s.resource = "icon.png" 110 | # s.resources = "Resources/*.png" 111 | 112 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 113 | 114 | 115 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 116 | # 117 | # Link your library with frameworks, or libraries. Libraries do not include 118 | # the lib prefix of their name. 119 | # 120 | 121 | # s.framework = "SomeFramework" 122 | # s.frameworks = "SomeFramework", "AnotherFramework" 123 | 124 | # s.library = "iconv" 125 | # s.libraries = "iconv", "xml2" 126 | 127 | 128 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 129 | # 130 | # If your library depends on compiler flags you can set them in the xcconfig hash 131 | # where they will only apply to your library. If you depend on other Podspecs 132 | # you can include multiple dependencies to ensure it works. 133 | 134 | # s.requires_arc = true 135 | 136 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 137 | # s.dependency "JSONKit", "~> 1.4" 138 | 139 | end 140 | -------------------------------------------------------------------------------- /Elapse.xcodeproj/ElapseTests_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | BNDL 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Elapse.xcodeproj/Elapse_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 | 1.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Elapse.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 92D0DD321F568B7D00E0DEE3 /* Elapse.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_8 /* Elapse.swift */; }; 11 | 92D0DD3B1F568BA500E0DEE3 /* Elapse.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_8 /* Elapse.swift */; }; 12 | 92D0DD441F568BBB00E0DEE3 /* Elapse.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_8 /* Elapse.swift */; }; 13 | OBJ_20 /* Elapse.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_8 /* Elapse.swift */; }; 14 | OBJ_27 /* ElapseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_11 /* ElapseTests.swift */; }; 15 | OBJ_29 /* Elapse.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = OBJ_13 /* Elapse.framework */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXContainerItemProxy section */ 19 | 92BE43B21ED746900076BAAE /* PBXContainerItemProxy */ = { 20 | isa = PBXContainerItemProxy; 21 | containerPortal = OBJ_1 /* Project object */; 22 | proxyType = 1; 23 | remoteGlobalIDString = OBJ_15; 24 | remoteInfo = Elapse; 25 | }; 26 | 92D0DD4C1F56A31C00E0DEE3 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = OBJ_1 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 92D0DD301F568B7D00E0DEE3; 31 | remoteInfo = Elapse_iOS; 32 | }; 33 | 92D0DD4E1F56A31C00E0DEE3 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = OBJ_1 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 92D0DD391F568BA500E0DEE3; 38 | remoteInfo = Elapse_tvOS; 39 | }; 40 | 92D0DD501F56A31C00E0DEE3 /* PBXContainerItemProxy */ = { 41 | isa = PBXContainerItemProxy; 42 | containerPortal = OBJ_1 /* Project object */; 43 | proxyType = 1; 44 | remoteGlobalIDString = 92D0DD421F568BBB00E0DEE3; 45 | remoteInfo = Elapse_watchOS; 46 | }; 47 | /* End PBXContainerItemProxy section */ 48 | 49 | /* Begin PBXFileReference section */ 50 | 92D0DD371F568B7D00E0DEE3 /* Elapse.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Elapse.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 92D0DD401F568BA500E0DEE3 /* Elapse.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Elapse.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 92D0DD491F568BBB00E0DEE3 /* Elapse.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Elapse.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | OBJ_11 /* ElapseTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElapseTests.swift; sourceTree = ""; }; 54 | OBJ_13 /* Elapse.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Elapse.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | OBJ_14 /* ElapseTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; path = ElapseTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | OBJ_6 /* Package.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 57 | OBJ_8 /* Elapse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Elapse.swift; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 92D0DD331F568B7D00E0DEE3 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 0; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | 92D0DD3C1F568BA500E0DEE3 /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 0; 71 | files = ( 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | 92D0DD451F568BBB00E0DEE3 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 0; 78 | files = ( 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | OBJ_21 /* Frameworks */ = { 83 | isa = PBXFrameworksBuildPhase; 84 | buildActionMask = 0; 85 | files = ( 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | OBJ_28 /* Frameworks */ = { 90 | isa = PBXFrameworksBuildPhase; 91 | buildActionMask = 0; 92 | files = ( 93 | OBJ_29 /* Elapse.framework in Frameworks */, 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | /* End PBXFrameworksBuildPhase section */ 98 | 99 | /* Begin PBXGroup section */ 100 | OBJ_10 /* ElapseTests */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | OBJ_11 /* ElapseTests.swift */, 104 | ); 105 | name = ElapseTests; 106 | path = Tests/ElapseTests; 107 | sourceTree = SOURCE_ROOT; 108 | }; 109 | OBJ_12 /* Products */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | OBJ_13 /* Elapse.framework */, 113 | OBJ_14 /* ElapseTests.xctest */, 114 | 92D0DD371F568B7D00E0DEE3 /* Elapse.framework */, 115 | 92D0DD401F568BA500E0DEE3 /* Elapse.framework */, 116 | 92D0DD491F568BBB00E0DEE3 /* Elapse.framework */, 117 | ); 118 | name = Products; 119 | sourceTree = BUILT_PRODUCTS_DIR; 120 | }; 121 | OBJ_5 = { 122 | isa = PBXGroup; 123 | children = ( 124 | OBJ_6 /* Package.swift */, 125 | OBJ_7 /* Sources */, 126 | OBJ_9 /* Tests */, 127 | OBJ_12 /* Products */, 128 | ); 129 | sourceTree = ""; 130 | }; 131 | OBJ_7 /* Sources */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | OBJ_8 /* Elapse.swift */, 135 | ); 136 | path = Sources; 137 | sourceTree = SOURCE_ROOT; 138 | }; 139 | OBJ_9 /* Tests */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | OBJ_10 /* ElapseTests */, 143 | ); 144 | name = Tests; 145 | sourceTree = SOURCE_ROOT; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | 92D0DD301F568B7D00E0DEE3 /* Elapse_iOS */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = 92D0DD341F568B7D00E0DEE3 /* Build configuration list for PBXNativeTarget "Elapse_iOS" */; 153 | buildPhases = ( 154 | 92D0DD311F568B7D00E0DEE3 /* Sources */, 155 | 92D0DD331F568B7D00E0DEE3 /* Frameworks */, 156 | ); 157 | buildRules = ( 158 | ); 159 | dependencies = ( 160 | ); 161 | name = Elapse_iOS; 162 | productName = Elapse; 163 | productReference = 92D0DD371F568B7D00E0DEE3 /* Elapse.framework */; 164 | productType = "com.apple.product-type.framework"; 165 | }; 166 | 92D0DD391F568BA500E0DEE3 /* Elapse_tvOS */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = 92D0DD3D1F568BA500E0DEE3 /* Build configuration list for PBXNativeTarget "Elapse_tvOS" */; 169 | buildPhases = ( 170 | 92D0DD3A1F568BA500E0DEE3 /* Sources */, 171 | 92D0DD3C1F568BA500E0DEE3 /* Frameworks */, 172 | ); 173 | buildRules = ( 174 | ); 175 | dependencies = ( 176 | ); 177 | name = Elapse_tvOS; 178 | productName = Elapse; 179 | productReference = 92D0DD401F568BA500E0DEE3 /* Elapse.framework */; 180 | productType = "com.apple.product-type.framework"; 181 | }; 182 | 92D0DD421F568BBB00E0DEE3 /* Elapse_watchOS */ = { 183 | isa = PBXNativeTarget; 184 | buildConfigurationList = 92D0DD461F568BBB00E0DEE3 /* Build configuration list for PBXNativeTarget "Elapse_watchOS" */; 185 | buildPhases = ( 186 | 92D0DD431F568BBB00E0DEE3 /* Sources */, 187 | 92D0DD451F568BBB00E0DEE3 /* Frameworks */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | ); 193 | name = Elapse_watchOS; 194 | productName = Elapse; 195 | productReference = 92D0DD491F568BBB00E0DEE3 /* Elapse.framework */; 196 | productType = "com.apple.product-type.framework"; 197 | }; 198 | OBJ_15 /* Elapse_macOS */ = { 199 | isa = PBXNativeTarget; 200 | buildConfigurationList = OBJ_16 /* Build configuration list for PBXNativeTarget "Elapse_macOS" */; 201 | buildPhases = ( 202 | OBJ_19 /* Sources */, 203 | OBJ_21 /* Frameworks */, 204 | ); 205 | buildRules = ( 206 | ); 207 | dependencies = ( 208 | ); 209 | name = Elapse_macOS; 210 | productName = Elapse; 211 | productReference = OBJ_13 /* Elapse.framework */; 212 | productType = "com.apple.product-type.framework"; 213 | }; 214 | OBJ_22 /* ElapseTests */ = { 215 | isa = PBXNativeTarget; 216 | buildConfigurationList = OBJ_23 /* Build configuration list for PBXNativeTarget "ElapseTests" */; 217 | buildPhases = ( 218 | OBJ_26 /* Sources */, 219 | OBJ_28 /* Frameworks */, 220 | ); 221 | buildRules = ( 222 | ); 223 | dependencies = ( 224 | 92D0DD4D1F56A31C00E0DEE3 /* PBXTargetDependency */, 225 | 92D0DD4F1F56A31C00E0DEE3 /* PBXTargetDependency */, 226 | 92D0DD511F56A31C00E0DEE3 /* PBXTargetDependency */, 227 | OBJ_30 /* PBXTargetDependency */, 228 | ); 229 | name = ElapseTests; 230 | productName = ElapseTests; 231 | productReference = OBJ_14 /* ElapseTests.xctest */; 232 | productType = "com.apple.product-type.bundle.unit-test"; 233 | }; 234 | /* End PBXNativeTarget section */ 235 | 236 | /* Begin PBXProject section */ 237 | OBJ_1 /* Project object */ = { 238 | isa = PBXProject; 239 | attributes = { 240 | LastUpgradeCheck = 1000; 241 | }; 242 | buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "Elapse" */; 243 | compatibilityVersion = "Xcode 3.2"; 244 | developmentRegion = English; 245 | hasScannedForEncodings = 0; 246 | knownRegions = ( 247 | en, 248 | ); 249 | mainGroup = OBJ_5; 250 | productRefGroup = OBJ_12 /* Products */; 251 | projectDirPath = ""; 252 | projectRoot = ""; 253 | targets = ( 254 | OBJ_15 /* Elapse_macOS */, 255 | 92D0DD301F568B7D00E0DEE3 /* Elapse_iOS */, 256 | 92D0DD391F568BA500E0DEE3 /* Elapse_tvOS */, 257 | 92D0DD421F568BBB00E0DEE3 /* Elapse_watchOS */, 258 | OBJ_22 /* ElapseTests */, 259 | ); 260 | }; 261 | /* End PBXProject section */ 262 | 263 | /* Begin PBXSourcesBuildPhase section */ 264 | 92D0DD311F568B7D00E0DEE3 /* Sources */ = { 265 | isa = PBXSourcesBuildPhase; 266 | buildActionMask = 0; 267 | files = ( 268 | 92D0DD321F568B7D00E0DEE3 /* Elapse.swift in Sources */, 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | 92D0DD3A1F568BA500E0DEE3 /* Sources */ = { 273 | isa = PBXSourcesBuildPhase; 274 | buildActionMask = 0; 275 | files = ( 276 | 92D0DD3B1F568BA500E0DEE3 /* Elapse.swift in Sources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | 92D0DD431F568BBB00E0DEE3 /* Sources */ = { 281 | isa = PBXSourcesBuildPhase; 282 | buildActionMask = 0; 283 | files = ( 284 | 92D0DD441F568BBB00E0DEE3 /* Elapse.swift in Sources */, 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | OBJ_19 /* Sources */ = { 289 | isa = PBXSourcesBuildPhase; 290 | buildActionMask = 0; 291 | files = ( 292 | OBJ_20 /* Elapse.swift in Sources */, 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | }; 296 | OBJ_26 /* Sources */ = { 297 | isa = PBXSourcesBuildPhase; 298 | buildActionMask = 0; 299 | files = ( 300 | OBJ_27 /* ElapseTests.swift in Sources */, 301 | ); 302 | runOnlyForDeploymentPostprocessing = 0; 303 | }; 304 | /* End PBXSourcesBuildPhase section */ 305 | 306 | /* Begin PBXTargetDependency section */ 307 | 92D0DD4D1F56A31C00E0DEE3 /* PBXTargetDependency */ = { 308 | isa = PBXTargetDependency; 309 | target = 92D0DD301F568B7D00E0DEE3 /* Elapse_iOS */; 310 | targetProxy = 92D0DD4C1F56A31C00E0DEE3 /* PBXContainerItemProxy */; 311 | }; 312 | 92D0DD4F1F56A31C00E0DEE3 /* PBXTargetDependency */ = { 313 | isa = PBXTargetDependency; 314 | target = 92D0DD391F568BA500E0DEE3 /* Elapse_tvOS */; 315 | targetProxy = 92D0DD4E1F56A31C00E0DEE3 /* PBXContainerItemProxy */; 316 | }; 317 | 92D0DD511F56A31C00E0DEE3 /* PBXTargetDependency */ = { 318 | isa = PBXTargetDependency; 319 | target = 92D0DD421F568BBB00E0DEE3 /* Elapse_watchOS */; 320 | targetProxy = 92D0DD501F56A31C00E0DEE3 /* PBXContainerItemProxy */; 321 | }; 322 | OBJ_30 /* PBXTargetDependency */ = { 323 | isa = PBXTargetDependency; 324 | target = OBJ_15 /* Elapse_macOS */; 325 | targetProxy = 92BE43B21ED746900076BAAE /* PBXContainerItemProxy */; 326 | }; 327 | /* End PBXTargetDependency section */ 328 | 329 | /* Begin XCBuildConfiguration section */ 330 | 92D0DD351F568B7D00E0DEE3 /* Debug */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | ENABLE_TESTABILITY = YES; 334 | FRAMEWORK_SEARCH_PATHS = ( 335 | "$(inherited)", 336 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 337 | ); 338 | HEADER_SEARCH_PATHS = "$(inherited)"; 339 | INFOPLIST_FILE = Elapse.xcodeproj/Elapse_Info.plist; 340 | LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 341 | OTHER_LDFLAGS = "$(inherited)"; 342 | OTHER_SWIFT_FLAGS = "$(inherited)"; 343 | PRODUCT_BUNDLE_IDENTIFIER = Elapse; 344 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 345 | PRODUCT_NAME = "$(TARGET_NAME)"; 346 | SDKROOT = iphoneos; 347 | SKIP_INSTALL = YES; 348 | SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; 349 | TARGET_NAME = Elapse; 350 | TVOS_DEPLOYMENT_TARGET = 10.2; 351 | WATCHOS_DEPLOYMENT_TARGET = 3.2; 352 | }; 353 | name = Debug; 354 | }; 355 | 92D0DD361F568B7D00E0DEE3 /* Release */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | ENABLE_TESTABILITY = YES; 359 | FRAMEWORK_SEARCH_PATHS = ( 360 | "$(inherited)", 361 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 362 | ); 363 | HEADER_SEARCH_PATHS = "$(inherited)"; 364 | INFOPLIST_FILE = Elapse.xcodeproj/Elapse_Info.plist; 365 | LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 366 | OTHER_LDFLAGS = "$(inherited)"; 367 | OTHER_SWIFT_FLAGS = "$(inherited)"; 368 | PRODUCT_BUNDLE_IDENTIFIER = Elapse; 369 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | SDKROOT = iphoneos; 372 | SKIP_INSTALL = YES; 373 | SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; 374 | TARGET_NAME = Elapse; 375 | TVOS_DEPLOYMENT_TARGET = 10.2; 376 | WATCHOS_DEPLOYMENT_TARGET = 3.2; 377 | }; 378 | name = Release; 379 | }; 380 | 92D0DD3E1F568BA500E0DEE3 /* Debug */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | CODE_SIGN_IDENTITY = ""; 384 | ENABLE_TESTABILITY = YES; 385 | FRAMEWORK_SEARCH_PATHS = ( 386 | "$(inherited)", 387 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 388 | ); 389 | HEADER_SEARCH_PATHS = "$(inherited)"; 390 | INFOPLIST_FILE = Elapse.xcodeproj/Elapse_Info.plist; 391 | LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 392 | OTHER_LDFLAGS = "$(inherited)"; 393 | OTHER_SWIFT_FLAGS = "$(inherited)"; 394 | PRODUCT_BUNDLE_IDENTIFIER = Elapse; 395 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | SDKROOT = appletvos; 398 | SKIP_INSTALL = YES; 399 | SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; 400 | TARGET_NAME = Elapse; 401 | TVOS_DEPLOYMENT_TARGET = 10.2; 402 | WATCHOS_DEPLOYMENT_TARGET = 3.2; 403 | }; 404 | name = Debug; 405 | }; 406 | 92D0DD3F1F568BA500E0DEE3 /* Release */ = { 407 | isa = XCBuildConfiguration; 408 | buildSettings = { 409 | CODE_SIGN_IDENTITY = ""; 410 | ENABLE_TESTABILITY = YES; 411 | FRAMEWORK_SEARCH_PATHS = ( 412 | "$(inherited)", 413 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 414 | ); 415 | HEADER_SEARCH_PATHS = "$(inherited)"; 416 | INFOPLIST_FILE = Elapse.xcodeproj/Elapse_Info.plist; 417 | LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 418 | OTHER_LDFLAGS = "$(inherited)"; 419 | OTHER_SWIFT_FLAGS = "$(inherited)"; 420 | PRODUCT_BUNDLE_IDENTIFIER = Elapse; 421 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 422 | PRODUCT_NAME = "$(TARGET_NAME)"; 423 | SDKROOT = appletvos; 424 | SKIP_INSTALL = YES; 425 | SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; 426 | TARGET_NAME = Elapse; 427 | TVOS_DEPLOYMENT_TARGET = 10.2; 428 | WATCHOS_DEPLOYMENT_TARGET = 3.2; 429 | }; 430 | name = Release; 431 | }; 432 | 92D0DD471F568BBB00E0DEE3 /* Debug */ = { 433 | isa = XCBuildConfiguration; 434 | buildSettings = { 435 | CODE_SIGN_IDENTITY = ""; 436 | ENABLE_TESTABILITY = YES; 437 | FRAMEWORK_SEARCH_PATHS = "$(inherited)"; 438 | HEADER_SEARCH_PATHS = "$(inherited)"; 439 | INFOPLIST_FILE = Elapse.xcodeproj/Elapse_Info.plist; 440 | LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 441 | OTHER_LDFLAGS = "$(inherited)"; 442 | OTHER_SWIFT_FLAGS = "$(inherited)"; 443 | PRODUCT_BUNDLE_IDENTIFIER = Elapse; 444 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 445 | PRODUCT_NAME = "$(TARGET_NAME)"; 446 | SDKROOT = watchos; 447 | SKIP_INSTALL = YES; 448 | SUPPORTED_PLATFORMS = "watchsimulator watchos"; 449 | TARGET_NAME = Elapse; 450 | TVOS_DEPLOYMENT_TARGET = 10.2; 451 | WATCHOS_DEPLOYMENT_TARGET = 3.2; 452 | }; 453 | name = Debug; 454 | }; 455 | 92D0DD481F568BBB00E0DEE3 /* Release */ = { 456 | isa = XCBuildConfiguration; 457 | buildSettings = { 458 | CODE_SIGN_IDENTITY = ""; 459 | ENABLE_TESTABILITY = YES; 460 | FRAMEWORK_SEARCH_PATHS = "$(inherited)"; 461 | HEADER_SEARCH_PATHS = "$(inherited)"; 462 | INFOPLIST_FILE = Elapse.xcodeproj/Elapse_Info.plist; 463 | LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 464 | OTHER_LDFLAGS = "$(inherited)"; 465 | OTHER_SWIFT_FLAGS = "$(inherited)"; 466 | PRODUCT_BUNDLE_IDENTIFIER = Elapse; 467 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 468 | PRODUCT_NAME = "$(TARGET_NAME)"; 469 | SDKROOT = watchos; 470 | SKIP_INSTALL = YES; 471 | SUPPORTED_PLATFORMS = "watchsimulator watchos"; 472 | TARGET_NAME = Elapse; 473 | TVOS_DEPLOYMENT_TARGET = 10.2; 474 | WATCHOS_DEPLOYMENT_TARGET = 3.2; 475 | }; 476 | name = Release; 477 | }; 478 | OBJ_17 /* Debug */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | ENABLE_TESTABILITY = YES; 482 | FRAMEWORK_SEARCH_PATHS = ( 483 | "$(inherited)", 484 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 485 | ); 486 | HEADER_SEARCH_PATHS = "$(inherited)"; 487 | INFOPLIST_FILE = Elapse.xcodeproj/Elapse_Info.plist; 488 | LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 489 | OTHER_LDFLAGS = "$(inherited)"; 490 | OTHER_SWIFT_FLAGS = "$(inherited)"; 491 | PRODUCT_BUNDLE_IDENTIFIER = Elapse; 492 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 493 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 494 | SKIP_INSTALL = YES; 495 | SUPPORTED_PLATFORMS = macosx; 496 | TARGET_NAME = Elapse; 497 | TVOS_DEPLOYMENT_TARGET = 10.2; 498 | WATCHOS_DEPLOYMENT_TARGET = 3.2; 499 | }; 500 | name = Debug; 501 | }; 502 | OBJ_18 /* Release */ = { 503 | isa = XCBuildConfiguration; 504 | buildSettings = { 505 | ENABLE_TESTABILITY = YES; 506 | FRAMEWORK_SEARCH_PATHS = ( 507 | "$(inherited)", 508 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 509 | ); 510 | HEADER_SEARCH_PATHS = "$(inherited)"; 511 | INFOPLIST_FILE = Elapse.xcodeproj/Elapse_Info.plist; 512 | LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 513 | OTHER_LDFLAGS = "$(inherited)"; 514 | OTHER_SWIFT_FLAGS = "$(inherited)"; 515 | PRODUCT_BUNDLE_IDENTIFIER = Elapse; 516 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 517 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 518 | SKIP_INSTALL = YES; 519 | SUPPORTED_PLATFORMS = macosx; 520 | TARGET_NAME = Elapse; 521 | TVOS_DEPLOYMENT_TARGET = 10.2; 522 | WATCHOS_DEPLOYMENT_TARGET = 3.2; 523 | }; 524 | name = Release; 525 | }; 526 | OBJ_24 /* Debug */ = { 527 | isa = XCBuildConfiguration; 528 | buildSettings = { 529 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 530 | FRAMEWORK_SEARCH_PATHS = ( 531 | "$(inherited)", 532 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 533 | ); 534 | HEADER_SEARCH_PATHS = "$(inherited)"; 535 | INFOPLIST_FILE = Elapse.xcodeproj/ElapseTests_Info.plist; 536 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 537 | LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @loader_path/Frameworks"; 538 | OTHER_LDFLAGS = "$(inherited)"; 539 | OTHER_SWIFT_FLAGS = "$(inherited)"; 540 | TARGET_NAME = ElapseTests; 541 | TVOS_DEPLOYMENT_TARGET = 10.2; 542 | WATCHOS_DEPLOYMENT_TARGET = 3.2; 543 | }; 544 | name = Debug; 545 | }; 546 | OBJ_25 /* Release */ = { 547 | isa = XCBuildConfiguration; 548 | buildSettings = { 549 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 550 | FRAMEWORK_SEARCH_PATHS = ( 551 | "$(inherited)", 552 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 553 | ); 554 | HEADER_SEARCH_PATHS = "$(inherited)"; 555 | INFOPLIST_FILE = Elapse.xcodeproj/ElapseTests_Info.plist; 556 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 557 | LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @loader_path/Frameworks"; 558 | OTHER_LDFLAGS = "$(inherited)"; 559 | OTHER_SWIFT_FLAGS = "$(inherited)"; 560 | TARGET_NAME = ElapseTests; 561 | TVOS_DEPLOYMENT_TARGET = 10.2; 562 | WATCHOS_DEPLOYMENT_TARGET = 3.2; 563 | }; 564 | name = Release; 565 | }; 566 | OBJ_3 /* Debug */ = { 567 | isa = XCBuildConfiguration; 568 | buildSettings = { 569 | CLANG_ENABLE_OBJC_ARC = YES; 570 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 571 | CLANG_WARN_BOOL_CONVERSION = YES; 572 | CLANG_WARN_COMMA = YES; 573 | CLANG_WARN_CONSTANT_CONVERSION = YES; 574 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 575 | CLANG_WARN_EMPTY_BODY = YES; 576 | CLANG_WARN_ENUM_CONVERSION = YES; 577 | CLANG_WARN_INFINITE_RECURSION = YES; 578 | CLANG_WARN_INT_CONVERSION = YES; 579 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 580 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 581 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 582 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 583 | CLANG_WARN_STRICT_PROTOTYPES = YES; 584 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 585 | CLANG_WARN_UNREACHABLE_CODE = YES; 586 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 587 | COMBINE_HIDPI_IMAGES = YES; 588 | COPY_PHASE_STRIP = NO; 589 | DEBUG_INFORMATION_FORMAT = dwarf; 590 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 591 | ENABLE_NS_ASSERTIONS = YES; 592 | ENABLE_STRICT_OBJC_MSGSEND = YES; 593 | ENABLE_TESTABILITY = YES; 594 | GCC_NO_COMMON_BLOCKS = YES; 595 | GCC_OPTIMIZATION_LEVEL = 0; 596 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 597 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 598 | GCC_WARN_UNDECLARED_SELECTOR = YES; 599 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 600 | GCC_WARN_UNUSED_FUNCTION = YES; 601 | GCC_WARN_UNUSED_VARIABLE = YES; 602 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 603 | MACOSX_DEPLOYMENT_TARGET = 10.10; 604 | ONLY_ACTIVE_ARCH = YES; 605 | OTHER_SWIFT_FLAGS = "-DXcode"; 606 | PRODUCT_NAME = "$(TARGET_NAME)"; 607 | SDKROOT = macosx; 608 | SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; 609 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = SWIFT_PACKAGE; 610 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 611 | SWIFT_VERSION = 4.2; 612 | USE_HEADERMAP = NO; 613 | }; 614 | name = Debug; 615 | }; 616 | OBJ_4 /* Release */ = { 617 | isa = XCBuildConfiguration; 618 | buildSettings = { 619 | CLANG_ENABLE_OBJC_ARC = YES; 620 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 621 | CLANG_WARN_BOOL_CONVERSION = YES; 622 | CLANG_WARN_COMMA = YES; 623 | CLANG_WARN_CONSTANT_CONVERSION = YES; 624 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 625 | CLANG_WARN_EMPTY_BODY = YES; 626 | CLANG_WARN_ENUM_CONVERSION = YES; 627 | CLANG_WARN_INFINITE_RECURSION = YES; 628 | CLANG_WARN_INT_CONVERSION = YES; 629 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 630 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 631 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 632 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 633 | CLANG_WARN_STRICT_PROTOTYPES = YES; 634 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 635 | CLANG_WARN_UNREACHABLE_CODE = YES; 636 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 637 | COMBINE_HIDPI_IMAGES = YES; 638 | COPY_PHASE_STRIP = YES; 639 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 640 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 641 | ENABLE_STRICT_OBJC_MSGSEND = YES; 642 | GCC_NO_COMMON_BLOCKS = YES; 643 | GCC_OPTIMIZATION_LEVEL = s; 644 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 645 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 646 | GCC_WARN_UNDECLARED_SELECTOR = YES; 647 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 648 | GCC_WARN_UNUSED_FUNCTION = YES; 649 | GCC_WARN_UNUSED_VARIABLE = YES; 650 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 651 | MACOSX_DEPLOYMENT_TARGET = 10.10; 652 | OTHER_SWIFT_FLAGS = "-DXcode"; 653 | PRODUCT_NAME = "$(TARGET_NAME)"; 654 | SDKROOT = macosx; 655 | SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; 656 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = SWIFT_PACKAGE; 657 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 658 | SWIFT_VERSION = 4.2; 659 | USE_HEADERMAP = NO; 660 | }; 661 | name = Release; 662 | }; 663 | /* End XCBuildConfiguration section */ 664 | 665 | /* Begin XCConfigurationList section */ 666 | 92D0DD341F568B7D00E0DEE3 /* Build configuration list for PBXNativeTarget "Elapse_iOS" */ = { 667 | isa = XCConfigurationList; 668 | buildConfigurations = ( 669 | 92D0DD351F568B7D00E0DEE3 /* Debug */, 670 | 92D0DD361F568B7D00E0DEE3 /* Release */, 671 | ); 672 | defaultConfigurationIsVisible = 0; 673 | defaultConfigurationName = Debug; 674 | }; 675 | 92D0DD3D1F568BA500E0DEE3 /* Build configuration list for PBXNativeTarget "Elapse_tvOS" */ = { 676 | isa = XCConfigurationList; 677 | buildConfigurations = ( 678 | 92D0DD3E1F568BA500E0DEE3 /* Debug */, 679 | 92D0DD3F1F568BA500E0DEE3 /* Release */, 680 | ); 681 | defaultConfigurationIsVisible = 0; 682 | defaultConfigurationName = Debug; 683 | }; 684 | 92D0DD461F568BBB00E0DEE3 /* Build configuration list for PBXNativeTarget "Elapse_watchOS" */ = { 685 | isa = XCConfigurationList; 686 | buildConfigurations = ( 687 | 92D0DD471F568BBB00E0DEE3 /* Debug */, 688 | 92D0DD481F568BBB00E0DEE3 /* Release */, 689 | ); 690 | defaultConfigurationIsVisible = 0; 691 | defaultConfigurationName = Debug; 692 | }; 693 | OBJ_16 /* Build configuration list for PBXNativeTarget "Elapse_macOS" */ = { 694 | isa = XCConfigurationList; 695 | buildConfigurations = ( 696 | OBJ_17 /* Debug */, 697 | OBJ_18 /* Release */, 698 | ); 699 | defaultConfigurationIsVisible = 0; 700 | defaultConfigurationName = Debug; 701 | }; 702 | OBJ_2 /* Build configuration list for PBXProject "Elapse" */ = { 703 | isa = XCConfigurationList; 704 | buildConfigurations = ( 705 | OBJ_3 /* Debug */, 706 | OBJ_4 /* Release */, 707 | ); 708 | defaultConfigurationIsVisible = 0; 709 | defaultConfigurationName = Debug; 710 | }; 711 | OBJ_23 /* Build configuration list for PBXNativeTarget "ElapseTests" */ = { 712 | isa = XCConfigurationList; 713 | buildConfigurations = ( 714 | OBJ_24 /* Debug */, 715 | OBJ_25 /* Release */, 716 | ); 717 | defaultConfigurationIsVisible = 0; 718 | defaultConfigurationName = Debug; 719 | }; 720 | /* End XCConfigurationList section */ 721 | }; 722 | rootObject = OBJ_1 /* Project object */; 723 | } 724 | -------------------------------------------------------------------------------- /Elapse.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Elapse.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Elapse.xcodeproj/xcshareddata/xcschemes/Elapse_iOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 79 | 85 | 86 | 87 | 88 | 89 | 90 | 96 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Elapse.xcodeproj/xcshareddata/xcschemes/Elapse_macOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 55 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 74 | 76 | 77 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /Elapse.xcodeproj/xcshareddata/xcschemes/Elapse_tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 79 | 85 | 86 | 87 | 88 | 89 | 90 | 96 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Elapse.xcodeproj/xcshareddata/xcschemes/Elapse_watchOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 79 | 85 | 86 | 87 | 88 | 89 | 90 | 96 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /Elapse.xcodeproj/xcshareddata/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SchemeUserState 5 | 6 | Elapse.xcscheme 7 | 8 | 9 | SuppressBuildableAutocreation 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | MIT License 3 | 4 | Copyright (c) 2017 Yoshihiro Kato 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:4.2 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "Elapse", 7 | products: [ 8 | .library(name: "Elapse", type: .dynamic, targets: ["Elapse"]) 9 | ], 10 | dependencies: [], 11 | targets: [ 12 | .target( 13 | name: "Elapse", 14 | dependencies: [], 15 | path: "Sources" 16 | ), 17 | .testTarget( 18 | name: "ElapseTests", 19 | dependencies: ["Elapse"], 20 | path: "Tests" 21 | ) 22 | ], 23 | swiftLanguageVersions: [.v4, .v4_2] 24 | ) 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Elapse 2 | ![Xcode](https://img.shields.io/badge/Xcode-10-brightgreen.svg) 3 | ![Swift](https://img.shields.io/badge/Swift-4.2-brightgreen.svg) 4 | ![platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS-333333.svg) 5 | ![Travis CI](https://travis-ci.org/yshrkt/Elapse.svg?branch=master) 6 | 7 | Elapse is tiny helper library for manipulating TimeInterval. 8 | 9 | ## Usage 10 | 11 | ### Calcurate TimeInterval easily. 12 | 13 | ```swift 14 | let days: TimeInterval = 3.days // 3 * 24 * 60 * 60 15 | let hours: TimeInterval = 3.hours // 3 * 60 * 60 16 | let minutes: TimeInterval = 3.minutes // 3 * 60 17 | let seconds: TimeInterval = 3.seconds // 3.0 18 | let mills: TimeInterval = 3.milliseconds // 0.003 19 | 20 | let time: TimeInterval = 3.days + 3.hours + 3.minutes 21 | 22 | ``` 23 | 24 | ### Separates TimeInterval to each components easily. 25 | ```swift 26 | 27 | let input: TimeInterval = 30.minutes + 30.seconds 28 | 29 | let output1 = input.components(of: [.minutes, .seconds]) 30 | print("\(output1.minutes):\(output1.seconds)") // "3:30" 31 | 32 | let output2 = input.components(of: [.minutes]) 33 | print("\(output2.minutes)min") // "30min" 34 | 35 | // You can also set the rounding mode. the default value is .floor 36 | let output3 = input.components(of: [.minutes], roundingMode: .ceiling) 37 | print("\(output3.minutes)min") // "31min" 38 | 39 | let output4 = input.components(of: [.minutes], roundingMode: .halfAwayFromZero) 40 | print("\(output4.minutes)min") // "31min" 41 | 42 | let output5 = (input - 1.seconds).components(of: [.minutes], roundingMode: .halfAwayFromZero) 43 | print("\(output5.minutes)min") // "30min" 44 | 45 | let output6 = input.components(of: [.hour], roundingMode: .halfAwayFromZero) 46 | print("\(output6.hours)hour") // "1hour" 47 | ``` 48 | 49 | ## Requirements 50 | 51 | * Xcode 10 52 | * Swift 4.2 53 | 54 | ## Installation 55 | 56 | ### Carthage 57 | 58 | To install it, simply add the following line to your `Cartfile`: 59 | 60 | ``` 61 | github "yshrkt/Elapse" 62 | ``` 63 | 64 | ### CocoaPods 65 | 66 | To install it, simply add the following line to your `Podfile`: 67 | 68 | ``` 69 | pod "Elapse" 70 | ``` 71 | 72 | ### Swift Package Manager 73 | 74 | To install it, simply add the proper description to your `Package.swift`: 75 | 76 | ```swift 77 | import PackageDescription 78 | 79 | let package = Package( 80 | name: "YOUR_PROJECT_NAME", 81 | targets: [], 82 | dependencies: [ 83 | .Package(url: "https://github.com/yshrkt/Elapse.git"), 84 | ] 85 | ) 86 | ``` 87 | 88 | ## Licence 89 | 90 | Elapse is released under the MIT license. [See LICENSE](https://github.com/yshrkt/Elapse/blob/master/LICENSE) for details. 91 | 92 | ## Author 93 | 94 | [yshrkt](https://github.com/yshrkt) 95 | -------------------------------------------------------------------------------- /Sources/Elapse.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public struct Elapse { 4 | 5 | public struct Units: OptionSet { 6 | public let rawValue: UInt8 7 | public init(rawValue: UInt8) { self.rawValue = rawValue } 8 | 9 | public static let millisecond = Units(rawValue: 1 << 0) 10 | public static let second = Units(rawValue: 1 << 1) 11 | public static let minute = Units(rawValue: 1 << 2) 12 | public static let hour = Units(rawValue: 1 << 3) 13 | public static let day = Units(rawValue: 1 << 4) 14 | 15 | public static let secondAndMillisecond: Units = [.second, .millisecond] 16 | public static let minuteAndSecond: Units = [.minute, .second] 17 | public static let hourAndMinute: Units = [.hour, .minute] 18 | public static let all: Units = [.day, .hour, .minute, second, millisecond] 19 | 20 | var highest: Units { 21 | if self.contains(.day) { 22 | return .day 23 | }else if self.contains(.hour) { 24 | return .hour 25 | } else if self.contains(.minute) { 26 | return .minute 27 | } else if self.contains(.second) { 28 | return .second 29 | } else if self.contains(.millisecond) { 30 | return .millisecond 31 | } else { 32 | return [] 33 | } 34 | } 35 | 36 | var lowest: Units { 37 | if self.contains(.millisecond) { 38 | return .millisecond 39 | } else if self.contains(.second) { 40 | return .second 41 | } else if self.contains(.minute) { 42 | return .minute 43 | } else if self.contains(.hour) { 44 | return .hour 45 | } else if self.contains(.day) { 46 | return .day 47 | } else { 48 | return [] 49 | } 50 | } 51 | } 52 | 53 | public enum Metric: TimeInterval { 54 | case millisecond = 0.001 55 | case second = 1 56 | case minute = 60 57 | case hour = 3600 58 | case day = 86400 59 | 60 | func convert(_ t: TimeInterval) -> Int64 { 61 | return Int64(t/self.rawValue) 62 | } 63 | 64 | func convert(_ v: Int64) -> TimeInterval { 65 | return TimeInterval(v) * self.rawValue 66 | } 67 | } 68 | 69 | public enum RoundingMode { 70 | case floor, ceiling, halfAwayFromZero 71 | 72 | func round(_ time: TimeInterval, metric: Metric) -> TimeInterval { 73 | let rounded: Int64 = {() -> Int64 in 74 | switch self { 75 | case .floor: 76 | return Int64((time / metric.rawValue).rounded(.towardZero)) 77 | case .ceiling: 78 | return Int64((time / metric.rawValue).rounded(.awayFromZero)) 79 | case .halfAwayFromZero: 80 | return Int64((time / metric.rawValue).rounded(.toNearestOrAwayFromZero)) 81 | } 82 | }() 83 | return TimeInterval(rounded) * metric.rawValue 84 | } 85 | } 86 | 87 | public typealias Components = (days: Int64, hours: Int64, minutes: Int64, seconds: Int64, milliseconds: Int64) 88 | } 89 | 90 | public extension Int { 91 | public var days: TimeInterval { 92 | return Elapse.Metric.day.convert(Int64(self)) 93 | } 94 | 95 | public var hours: TimeInterval { 96 | return Elapse.Metric.hour.convert(Int64(self)) 97 | } 98 | 99 | public var minutes: TimeInterval { 100 | return Elapse.Metric.minute.convert(Int64(self)) 101 | } 102 | 103 | public var seconds: TimeInterval { 104 | return Elapse.Metric.second.convert(Int64(self)) 105 | } 106 | 107 | public var milliseconds: TimeInterval { 108 | return Elapse.Metric.millisecond.convert(Int64(self)) 109 | } 110 | 111 | } 112 | 113 | public extension TimeInterval { 114 | 115 | public func components(of units: Elapse.Units, 116 | roundingMode: Elapse.RoundingMode = .floor) -> Elapse.Components { 117 | let time = { (time: TimeInterval) -> TimeInterval in 118 | if units.lowest == .day { 119 | return roundingMode.round(time, metric: .day) 120 | }else if units.lowest == .hour { 121 | return roundingMode.round(time, metric: .hour) 122 | } else if units.lowest == .minute { 123 | return roundingMode.round(time, metric: .minute) 124 | } else if units.lowest == .second { 125 | return roundingMode.round(time, metric: .second) 126 | } else { 127 | return roundingMode.round(time, metric: .millisecond) 128 | } 129 | }(self) 130 | 131 | let convert = {(time: TimeInterval, metric: Elapse.Metric) -> Int64 in 132 | return metric.convert(time) 133 | } 134 | 135 | let days: Int64 = { 136 | return units.contains(.day) ? convert(time, .day) : 0 137 | }() 138 | 139 | let hours: Int64 = { 140 | let t = units.contains(.hour) ? convert(time, .hour) : 0 141 | return (units.highest == .hour) ? t : t % 24 142 | }() 143 | 144 | let minutes: Int64 = { 145 | let t = units.contains(.minute) ? convert(time, .minute) : 0 146 | return (units.highest == .minute) ? t : t % 60 147 | }() 148 | 149 | let seconds: Int64 = { 150 | let t = units.contains(.second) ? convert(time, .second) : 0 151 | return (units.highest == .second) ? t : t % 60 152 | }() 153 | 154 | let milliseconds: Int64 = { 155 | let t = units.contains(.millisecond) ? convert(time, .millisecond) : 0 156 | return (units.highest == .millisecond) ? t : t % 1000 157 | }() 158 | 159 | return (days: days, 160 | hours: hours, 161 | minutes: minutes, 162 | seconds: seconds, 163 | milliseconds: milliseconds) 164 | } 165 | } 166 | 167 | -------------------------------------------------------------------------------- /Tests/ElapseTests/ElapseTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import Elapse 3 | 4 | class ElapseTests: XCTestCase { 5 | func testDays() { 6 | let time: TimeInterval = 3.days 7 | 8 | XCTAssertEqual(time, 3 * 24 * 60 * 60) 9 | XCTAssertEqual(time.components(of: .day).days, 3) 10 | XCTAssertEqual(time.components(of: .hour).days, 0) 11 | XCTAssertEqual(time.components(of: .hour).hours, 3 * 24) 12 | XCTAssertEqual(time.components(of: .minute).minutes, 3 * 24 * 60) 13 | XCTAssertEqual(time.components(of: .second).seconds, 3 * 24 * 60 * 60) 14 | XCTAssertEqual(time.components(of: .millisecond).milliseconds, 3 * 24 * 60 * 60 * 1000) 15 | } 16 | 17 | func testHours() { 18 | let time: TimeInterval = 3.hours 19 | 20 | XCTAssertEqual(time, 3 * 60 * 60) 21 | XCTAssertEqual(time.components(of: .day).days, 0) 22 | XCTAssertEqual(time.components(of: .day).hours, 0) 23 | XCTAssertEqual(time.components(of: .hour).hours, 3) 24 | XCTAssertEqual(time.components(of: .minute).minutes, 3 * 60) 25 | XCTAssertEqual(time.components(of: .second).seconds, 3 * 60 * 60) 26 | XCTAssertEqual(time.components(of: .millisecond).milliseconds, 3 * 60 * 60 * 1000) 27 | } 28 | 29 | func testMimutes() { 30 | let time: TimeInterval = 3.minutes 31 | 32 | XCTAssertEqual(time, 3 * 60) 33 | XCTAssertEqual(time.components(of: .day).days, 0) 34 | XCTAssertEqual(time.components(of: .day).hours, 0) 35 | XCTAssertEqual(time.components(of: .day).minutes, 0) 36 | XCTAssertEqual(time.components(of: .hour).hours, 0) 37 | XCTAssertEqual(time.components(of: .hour).minutes, 0) 38 | XCTAssertEqual(time.components(of: .minute).minutes, 3) 39 | XCTAssertEqual(time.components(of: .second).seconds, 3 * 60) 40 | XCTAssertEqual(time.components(of: .millisecond).milliseconds, 3 * 60 * 1000) 41 | } 42 | 43 | func testSeconds() { 44 | let time: TimeInterval = 3.seconds 45 | 46 | XCTAssertEqual(time, 3) 47 | XCTAssertEqual(time.components(of: .day).days, 0) 48 | XCTAssertEqual(time.components(of: .day).hours, 0) 49 | XCTAssertEqual(time.components(of: .day).minutes, 0) 50 | XCTAssertEqual(time.components(of: .day).seconds, 0) 51 | XCTAssertEqual(time.components(of: .hour).hours, 0) 52 | XCTAssertEqual(time.components(of: .hour).minutes, 0) 53 | XCTAssertEqual(time.components(of: .hour).seconds, 0) 54 | XCTAssertEqual(time.components(of: .minute).minutes, 0) 55 | XCTAssertEqual(time.components(of: .minute).seconds, 0) 56 | XCTAssertEqual(time.components(of: .second).seconds, 3) 57 | XCTAssertEqual(time.components(of: .millisecond).milliseconds, 3 * 1000) 58 | } 59 | 60 | func testMilliseconds() { 61 | let time: TimeInterval = 3.milliseconds 62 | 63 | XCTAssertEqual(time, 0.003) 64 | XCTAssertEqual(time.components(of: .day).days, 0) 65 | XCTAssertEqual(time.components(of: .day).hours, 0) 66 | XCTAssertEqual(time.components(of: .day).minutes, 0) 67 | XCTAssertEqual(time.components(of: .day).seconds, 0) 68 | XCTAssertEqual(time.components(of: .day).milliseconds, 0) 69 | XCTAssertEqual(time.components(of: .hour).hours, 0) 70 | XCTAssertEqual(time.components(of: .hour).minutes, 0) 71 | XCTAssertEqual(time.components(of: .hour).seconds, 0) 72 | XCTAssertEqual(time.components(of: .hour).milliseconds, 0) 73 | XCTAssertEqual(time.components(of: .minute).minutes, 0) 74 | XCTAssertEqual(time.components(of: .minute).seconds, 0) 75 | XCTAssertEqual(time.components(of: .minute).milliseconds, 0) 76 | XCTAssertEqual(time.components(of: .second).seconds, 0) 77 | XCTAssertEqual(time.components(of: .second).milliseconds, 0) 78 | XCTAssertEqual(time.components(of: .millisecond).milliseconds, 3) 79 | } 80 | 81 | func testHoursAndMinutes() { 82 | let time: TimeInterval = 3.hours + 3.minutes 83 | 84 | XCTAssertEqual(time.components(of: .hourAndMinute).days, 0) 85 | XCTAssertEqual(time.components(of: .hourAndMinute).hours, 3) 86 | XCTAssertEqual(time.components(of: .hourAndMinute).minutes, 3) 87 | XCTAssertEqual(time.components(of: .hourAndMinute).seconds, 0) 88 | XCTAssertEqual(time.components(of: .hourAndMinute).milliseconds, 0) 89 | 90 | XCTAssertEqual(time.components(of: .minuteAndSecond).days, 0) 91 | XCTAssertEqual(time.components(of: .minuteAndSecond).hours, 0) 92 | XCTAssertEqual(time.components(of: .minuteAndSecond).minutes, 3 * 60 + 3) 93 | XCTAssertEqual(time.components(of: .minuteAndSecond).seconds, 0) 94 | XCTAssertEqual(time.components(of: .minuteAndSecond).milliseconds, 0) 95 | } 96 | 97 | func testMimutesAndSeconds() { 98 | let time: TimeInterval = 3.minutes + 3.seconds 99 | 100 | XCTAssertEqual(time.components(of: .minuteAndSecond).days, 0) 101 | XCTAssertEqual(time.components(of: .minuteAndSecond).hours, 0) 102 | XCTAssertEqual(time.components(of: .minuteAndSecond).minutes, 3) 103 | XCTAssertEqual(time.components(of: .minuteAndSecond).seconds, 3) 104 | XCTAssertEqual(time.components(of: .minuteAndSecond).milliseconds, 0) 105 | 106 | XCTAssertEqual(time.components(of: .secondAndMillisecond).days, 0) 107 | XCTAssertEqual(time.components(of: .secondAndMillisecond).hours, 0) 108 | XCTAssertEqual(time.components(of: .secondAndMillisecond).minutes, 0) 109 | XCTAssertEqual(time.components(of: .secondAndMillisecond).seconds, 3 * 60 + 3) 110 | XCTAssertEqual(time.components(of: .secondAndMillisecond).milliseconds, 0) 111 | } 112 | 113 | func testSecondsAndMilliseconds() { 114 | let time: TimeInterval = 3.seconds + 3.milliseconds 115 | 116 | XCTAssertEqual(time.components(of: .secondAndMillisecond).days, 0) 117 | XCTAssertEqual(time.components(of: .secondAndMillisecond).hours, 0) 118 | XCTAssertEqual(time.components(of: .secondAndMillisecond).minutes, 0) 119 | XCTAssertEqual(time.components(of: .secondAndMillisecond).seconds, 3) 120 | XCTAssertEqual(time.components(of: .secondAndMillisecond).milliseconds, 3) 121 | } 122 | 123 | func testCeiling() { 124 | let time: TimeInterval = 3.days + 3.hours + 3.minutes + 3.seconds + 3.milliseconds 125 | 126 | XCTAssertEqual(time.components(of: .day, roundingMode: .ceiling).days, 4) 127 | let h: Int64 = 3 * 24 + 3 128 | XCTAssertEqual(time.components(of: .hour, roundingMode: .ceiling).hours, h + Int64(1)) 129 | let m: Int64 = h * 60 + 3 130 | XCTAssertEqual(time.components(of: .minute, roundingMode: .ceiling).minutes, m + Int64(1)) 131 | let s: Int64 = m * 60 + 3 132 | XCTAssertEqual(time.components(of: .second, roundingMode: .ceiling).seconds, s + Int64(1)) 133 | } 134 | 135 | func testHalfAwayFromZero() { 136 | let time1: TimeInterval = 3.days + 11.hours + 29.minutes + 29.seconds + 499.milliseconds 137 | 138 | XCTAssertEqual(time1.components(of: .day, roundingMode: .halfAwayFromZero).days, 3) 139 | let h1: Int64 = 3 * 24 + 11 140 | XCTAssertEqual(time1.components(of: .hour, roundingMode: .halfAwayFromZero).hours, h1) 141 | let m1: Int64 = h1 * 60 + 29 142 | XCTAssertEqual(time1.components(of: .minute, roundingMode: .halfAwayFromZero).minutes, m1) 143 | let s1: Int64 = m1 * 60 + 29 144 | XCTAssertEqual(time1.components(of: .second, roundingMode: .halfAwayFromZero).seconds, s1) 145 | 146 | 147 | let time2: TimeInterval = 3.days + 12.hours + 30.minutes + 30.seconds + 500.milliseconds 148 | 149 | XCTAssertEqual(time2.components(of: .day, roundingMode: .halfAwayFromZero).days, 4) 150 | let h2: Int64 = 3 * 24 + 12 151 | XCTAssertEqual(time2.components(of: .hour, roundingMode: .halfAwayFromZero).hours, h2 + Int64(1)) 152 | let m2: Int64 = h2 * 60 + 30 153 | XCTAssertEqual(time2.components(of: .minute, roundingMode: .halfAwayFromZero).minutes, m2 + Int64(1)) 154 | let s2: Int64 = m2 * 60 + 30 155 | XCTAssertEqual(time2.components(of: .second, roundingMode: .halfAwayFromZero).seconds, s2 + Int64(1)) 156 | } 157 | 158 | 159 | static var allTests = [ 160 | ("testDays", testDays), 161 | ("testHours", testHours), 162 | ("testMimutes", testMimutes), 163 | ("testSeconds", testSeconds), 164 | ("testMilliseconds", testMilliseconds), 165 | ("testHoursAndMinutes", testHoursAndMinutes), 166 | ("testMimutesAndSeconds", testMimutesAndSeconds), 167 | ("testSecondsAndMilliseconds", testSecondsAndMilliseconds), 168 | ("testCeiling", testCeiling), 169 | ("testHalfAwayFromZero", testHalfAwayFromZero) 170 | ] 171 | } 172 | -------------------------------------------------------------------------------- /Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import ElapseTests 3 | 4 | XCTMain([ 5 | testCase(ElapseTests.allTests) 6 | ]) 7 | --------------------------------------------------------------------------------