├── LICENSE ├── MMTimeLine_Swift ├── MMTimeLine_Swift.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── wyy.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── wyy.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── MMTimeLine_Swift.xcscheme │ │ └── xcschememanagement.plist ├── MMTimeLine_Swift │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── MMTimeLineCell.swift │ ├── MMTimeLineLayout.swift │ ├── MMTimeLineModel.swift │ └── ViewController.swift ├── MMTimeLine_SwiftTests │ ├── Info.plist │ └── MMTimeLine_SwiftTests.swift └── MMTimeLine_SwiftUITests │ ├── Info.plist │ └── MMTimeLine_SwiftUITests.swift └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 the way 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 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 75B6749F1EE8E1730012155A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B6749E1EE8E1730012155A /* AppDelegate.swift */; }; 11 | 75B674A11EE8E1730012155A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B674A01EE8E1730012155A /* ViewController.swift */; }; 12 | 75B674A41EE8E1730012155A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 75B674A21EE8E1730012155A /* Main.storyboard */; }; 13 | 75B674A61EE8E1730012155A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 75B674A51EE8E1730012155A /* Assets.xcassets */; }; 14 | 75B674A91EE8E1730012155A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 75B674A71EE8E1730012155A /* LaunchScreen.storyboard */; }; 15 | 75B674B41EE8E1740012155A /* MMTimeLine_SwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B674B31EE8E1740012155A /* MMTimeLine_SwiftTests.swift */; }; 16 | 75B674BF1EE8E1740012155A /* MMTimeLine_SwiftUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B674BE1EE8E1740012155A /* MMTimeLine_SwiftUITests.swift */; }; 17 | 75B674CD1EE8E7200012155A /* MMTimeLineCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B674CC1EE8E7200012155A /* MMTimeLineCell.swift */; }; 18 | 75B674CF1EE8EB3A0012155A /* MMTimeLineModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B674CE1EE8EB3A0012155A /* MMTimeLineModel.swift */; }; 19 | 75B674D11EE8EF8D0012155A /* MMTimeLineLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B674D01EE8EF8D0012155A /* MMTimeLineLayout.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 75B674B01EE8E1740012155A /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 75B674931EE8E1730012155A /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 75B6749A1EE8E1730012155A; 28 | remoteInfo = MMTimeLine_Swift; 29 | }; 30 | 75B674BB1EE8E1740012155A /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 75B674931EE8E1730012155A /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 75B6749A1EE8E1730012155A; 35 | remoteInfo = MMTimeLine_Swift; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 75B6749B1EE8E1730012155A /* MMTimeLine_Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MMTimeLine_Swift.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 75B6749E1EE8E1730012155A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 42 | 75B674A01EE8E1730012155A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 43 | 75B674A31EE8E1730012155A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 75B674A51EE8E1730012155A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | 75B674A81EE8E1730012155A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 75B674AA1EE8E1730012155A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | 75B674AF1EE8E1740012155A /* MMTimeLine_SwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MMTimeLine_SwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 75B674B31EE8E1740012155A /* MMTimeLine_SwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMTimeLine_SwiftTests.swift; sourceTree = ""; }; 49 | 75B674B51EE8E1740012155A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 75B674BA1EE8E1740012155A /* MMTimeLine_SwiftUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MMTimeLine_SwiftUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 75B674BE1EE8E1740012155A /* MMTimeLine_SwiftUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMTimeLine_SwiftUITests.swift; sourceTree = ""; }; 52 | 75B674C01EE8E1740012155A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 75B674CC1EE8E7200012155A /* MMTimeLineCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MMTimeLineCell.swift; sourceTree = ""; }; 54 | 75B674CE1EE8EB3A0012155A /* MMTimeLineModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MMTimeLineModel.swift; sourceTree = ""; }; 55 | 75B674D01EE8EF8D0012155A /* MMTimeLineLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MMTimeLineLayout.swift; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 75B674981EE8E1730012155A /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | 75B674AC1EE8E1740012155A /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | 75B674B71EE8E1740012155A /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | /* End PBXFrameworksBuildPhase section */ 81 | 82 | /* Begin PBXGroup section */ 83 | 75B674921EE8E1730012155A = { 84 | isa = PBXGroup; 85 | children = ( 86 | 75B6749D1EE8E1730012155A /* MMTimeLine_Swift */, 87 | 75B674B21EE8E1740012155A /* MMTimeLine_SwiftTests */, 88 | 75B674BD1EE8E1740012155A /* MMTimeLine_SwiftUITests */, 89 | 75B6749C1EE8E1730012155A /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 75B6749C1EE8E1730012155A /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 75B6749B1EE8E1730012155A /* MMTimeLine_Swift.app */, 97 | 75B674AF1EE8E1740012155A /* MMTimeLine_SwiftTests.xctest */, 98 | 75B674BA1EE8E1740012155A /* MMTimeLine_SwiftUITests.xctest */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | 75B6749D1EE8E1730012155A /* MMTimeLine_Swift */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 75B674CC1EE8E7200012155A /* MMTimeLineCell.swift */, 107 | 75B6749E1EE8E1730012155A /* AppDelegate.swift */, 108 | 75B674A01EE8E1730012155A /* ViewController.swift */, 109 | 75B674CE1EE8EB3A0012155A /* MMTimeLineModel.swift */, 110 | 75B674D01EE8EF8D0012155A /* MMTimeLineLayout.swift */, 111 | 75B674A21EE8E1730012155A /* Main.storyboard */, 112 | 75B674A51EE8E1730012155A /* Assets.xcassets */, 113 | 75B674A71EE8E1730012155A /* LaunchScreen.storyboard */, 114 | 75B674AA1EE8E1730012155A /* Info.plist */, 115 | ); 116 | path = MMTimeLine_Swift; 117 | sourceTree = ""; 118 | }; 119 | 75B674B21EE8E1740012155A /* MMTimeLine_SwiftTests */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 75B674B31EE8E1740012155A /* MMTimeLine_SwiftTests.swift */, 123 | 75B674B51EE8E1740012155A /* Info.plist */, 124 | ); 125 | path = MMTimeLine_SwiftTests; 126 | sourceTree = ""; 127 | }; 128 | 75B674BD1EE8E1740012155A /* MMTimeLine_SwiftUITests */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 75B674BE1EE8E1740012155A /* MMTimeLine_SwiftUITests.swift */, 132 | 75B674C01EE8E1740012155A /* Info.plist */, 133 | ); 134 | path = MMTimeLine_SwiftUITests; 135 | sourceTree = ""; 136 | }; 137 | /* End PBXGroup section */ 138 | 139 | /* Begin PBXNativeTarget section */ 140 | 75B6749A1EE8E1730012155A /* MMTimeLine_Swift */ = { 141 | isa = PBXNativeTarget; 142 | buildConfigurationList = 75B674C31EE8E1740012155A /* Build configuration list for PBXNativeTarget "MMTimeLine_Swift" */; 143 | buildPhases = ( 144 | 75B674971EE8E1730012155A /* Sources */, 145 | 75B674981EE8E1730012155A /* Frameworks */, 146 | 75B674991EE8E1730012155A /* Resources */, 147 | ); 148 | buildRules = ( 149 | ); 150 | dependencies = ( 151 | ); 152 | name = MMTimeLine_Swift; 153 | productName = MMTimeLine_Swift; 154 | productReference = 75B6749B1EE8E1730012155A /* MMTimeLine_Swift.app */; 155 | productType = "com.apple.product-type.application"; 156 | }; 157 | 75B674AE1EE8E1740012155A /* MMTimeLine_SwiftTests */ = { 158 | isa = PBXNativeTarget; 159 | buildConfigurationList = 75B674C61EE8E1740012155A /* Build configuration list for PBXNativeTarget "MMTimeLine_SwiftTests" */; 160 | buildPhases = ( 161 | 75B674AB1EE8E1740012155A /* Sources */, 162 | 75B674AC1EE8E1740012155A /* Frameworks */, 163 | 75B674AD1EE8E1740012155A /* Resources */, 164 | ); 165 | buildRules = ( 166 | ); 167 | dependencies = ( 168 | 75B674B11EE8E1740012155A /* PBXTargetDependency */, 169 | ); 170 | name = MMTimeLine_SwiftTests; 171 | productName = MMTimeLine_SwiftTests; 172 | productReference = 75B674AF1EE8E1740012155A /* MMTimeLine_SwiftTests.xctest */; 173 | productType = "com.apple.product-type.bundle.unit-test"; 174 | }; 175 | 75B674B91EE8E1740012155A /* MMTimeLine_SwiftUITests */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = 75B674C91EE8E1740012155A /* Build configuration list for PBXNativeTarget "MMTimeLine_SwiftUITests" */; 178 | buildPhases = ( 179 | 75B674B61EE8E1740012155A /* Sources */, 180 | 75B674B71EE8E1740012155A /* Frameworks */, 181 | 75B674B81EE8E1740012155A /* Resources */, 182 | ); 183 | buildRules = ( 184 | ); 185 | dependencies = ( 186 | 75B674BC1EE8E1740012155A /* PBXTargetDependency */, 187 | ); 188 | name = MMTimeLine_SwiftUITests; 189 | productName = MMTimeLine_SwiftUITests; 190 | productReference = 75B674BA1EE8E1740012155A /* MMTimeLine_SwiftUITests.xctest */; 191 | productType = "com.apple.product-type.bundle.ui-testing"; 192 | }; 193 | /* End PBXNativeTarget section */ 194 | 195 | /* Begin PBXProject section */ 196 | 75B674931EE8E1730012155A /* Project object */ = { 197 | isa = PBXProject; 198 | attributes = { 199 | LastSwiftUpdateCheck = 0810; 200 | LastUpgradeCheck = 0810; 201 | ORGANIZATIONNAME = wyy; 202 | TargetAttributes = { 203 | 75B6749A1EE8E1730012155A = { 204 | CreatedOnToolsVersion = 8.1; 205 | DevelopmentTeam = 65Y8F76Y6Z; 206 | ProvisioningStyle = Automatic; 207 | }; 208 | 75B674AE1EE8E1740012155A = { 209 | CreatedOnToolsVersion = 8.1; 210 | DevelopmentTeam = 65Y8F76Y6Z; 211 | ProvisioningStyle = Automatic; 212 | TestTargetID = 75B6749A1EE8E1730012155A; 213 | }; 214 | 75B674B91EE8E1740012155A = { 215 | CreatedOnToolsVersion = 8.1; 216 | DevelopmentTeam = 65Y8F76Y6Z; 217 | ProvisioningStyle = Automatic; 218 | TestTargetID = 75B6749A1EE8E1730012155A; 219 | }; 220 | }; 221 | }; 222 | buildConfigurationList = 75B674961EE8E1730012155A /* Build configuration list for PBXProject "MMTimeLine_Swift" */; 223 | compatibilityVersion = "Xcode 3.2"; 224 | developmentRegion = English; 225 | hasScannedForEncodings = 0; 226 | knownRegions = ( 227 | en, 228 | Base, 229 | ); 230 | mainGroup = 75B674921EE8E1730012155A; 231 | productRefGroup = 75B6749C1EE8E1730012155A /* Products */; 232 | projectDirPath = ""; 233 | projectRoot = ""; 234 | targets = ( 235 | 75B6749A1EE8E1730012155A /* MMTimeLine_Swift */, 236 | 75B674AE1EE8E1740012155A /* MMTimeLine_SwiftTests */, 237 | 75B674B91EE8E1740012155A /* MMTimeLine_SwiftUITests */, 238 | ); 239 | }; 240 | /* End PBXProject section */ 241 | 242 | /* Begin PBXResourcesBuildPhase section */ 243 | 75B674991EE8E1730012155A /* Resources */ = { 244 | isa = PBXResourcesBuildPhase; 245 | buildActionMask = 2147483647; 246 | files = ( 247 | 75B674A91EE8E1730012155A /* LaunchScreen.storyboard in Resources */, 248 | 75B674A61EE8E1730012155A /* Assets.xcassets in Resources */, 249 | 75B674A41EE8E1730012155A /* Main.storyboard in Resources */, 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | 75B674AD1EE8E1740012155A /* Resources */ = { 254 | isa = PBXResourcesBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | 75B674B81EE8E1740012155A /* Resources */ = { 261 | isa = PBXResourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | /* End PBXResourcesBuildPhase section */ 268 | 269 | /* Begin PBXSourcesBuildPhase section */ 270 | 75B674971EE8E1730012155A /* Sources */ = { 271 | isa = PBXSourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | 75B674A11EE8E1730012155A /* ViewController.swift in Sources */, 275 | 75B674D11EE8EF8D0012155A /* MMTimeLineLayout.swift in Sources */, 276 | 75B674CD1EE8E7200012155A /* MMTimeLineCell.swift in Sources */, 277 | 75B6749F1EE8E1730012155A /* AppDelegate.swift in Sources */, 278 | 75B674CF1EE8EB3A0012155A /* MMTimeLineModel.swift in Sources */, 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | }; 282 | 75B674AB1EE8E1740012155A /* Sources */ = { 283 | isa = PBXSourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | 75B674B41EE8E1740012155A /* MMTimeLine_SwiftTests.swift in Sources */, 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | 75B674B61EE8E1740012155A /* Sources */ = { 291 | isa = PBXSourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 75B674BF1EE8E1740012155A /* MMTimeLine_SwiftUITests.swift in Sources */, 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | /* End PBXSourcesBuildPhase section */ 299 | 300 | /* Begin PBXTargetDependency section */ 301 | 75B674B11EE8E1740012155A /* PBXTargetDependency */ = { 302 | isa = PBXTargetDependency; 303 | target = 75B6749A1EE8E1730012155A /* MMTimeLine_Swift */; 304 | targetProxy = 75B674B01EE8E1740012155A /* PBXContainerItemProxy */; 305 | }; 306 | 75B674BC1EE8E1740012155A /* PBXTargetDependency */ = { 307 | isa = PBXTargetDependency; 308 | target = 75B6749A1EE8E1730012155A /* MMTimeLine_Swift */; 309 | targetProxy = 75B674BB1EE8E1740012155A /* PBXContainerItemProxy */; 310 | }; 311 | /* End PBXTargetDependency section */ 312 | 313 | /* Begin PBXVariantGroup section */ 314 | 75B674A21EE8E1730012155A /* Main.storyboard */ = { 315 | isa = PBXVariantGroup; 316 | children = ( 317 | 75B674A31EE8E1730012155A /* Base */, 318 | ); 319 | name = Main.storyboard; 320 | sourceTree = ""; 321 | }; 322 | 75B674A71EE8E1730012155A /* LaunchScreen.storyboard */ = { 323 | isa = PBXVariantGroup; 324 | children = ( 325 | 75B674A81EE8E1730012155A /* Base */, 326 | ); 327 | name = LaunchScreen.storyboard; 328 | sourceTree = ""; 329 | }; 330 | /* End PBXVariantGroup section */ 331 | 332 | /* Begin XCBuildConfiguration section */ 333 | 75B674C11EE8E1740012155A /* Debug */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_CONSTANT_CONVERSION = YES; 344 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 345 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 346 | CLANG_WARN_EMPTY_BODY = YES; 347 | CLANG_WARN_ENUM_CONVERSION = YES; 348 | CLANG_WARN_INFINITE_RECURSION = YES; 349 | CLANG_WARN_INT_CONVERSION = YES; 350 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 351 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 352 | CLANG_WARN_UNREACHABLE_CODE = YES; 353 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 354 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 355 | COPY_PHASE_STRIP = NO; 356 | DEBUG_INFORMATION_FORMAT = dwarf; 357 | ENABLE_STRICT_OBJC_MSGSEND = YES; 358 | ENABLE_TESTABILITY = YES; 359 | GCC_C_LANGUAGE_STANDARD = gnu99; 360 | GCC_DYNAMIC_NO_PIC = NO; 361 | GCC_NO_COMMON_BLOCKS = YES; 362 | GCC_OPTIMIZATION_LEVEL = 0; 363 | GCC_PREPROCESSOR_DEFINITIONS = ( 364 | "DEBUG=1", 365 | "$(inherited)", 366 | ); 367 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 368 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 369 | GCC_WARN_UNDECLARED_SELECTOR = YES; 370 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 371 | GCC_WARN_UNUSED_FUNCTION = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 374 | MTL_ENABLE_DEBUG_INFO = YES; 375 | ONLY_ACTIVE_ARCH = YES; 376 | SDKROOT = iphoneos; 377 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 378 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 379 | TARGETED_DEVICE_FAMILY = "1,2"; 380 | }; 381 | name = Debug; 382 | }; 383 | 75B674C21EE8E1740012155A /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ALWAYS_SEARCH_USER_PATHS = NO; 387 | CLANG_ANALYZER_NONNULL = YES; 388 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 389 | CLANG_CXX_LIBRARY = "libc++"; 390 | CLANG_ENABLE_MODULES = YES; 391 | CLANG_ENABLE_OBJC_ARC = YES; 392 | CLANG_WARN_BOOL_CONVERSION = YES; 393 | CLANG_WARN_CONSTANT_CONVERSION = YES; 394 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 395 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 396 | CLANG_WARN_EMPTY_BODY = YES; 397 | CLANG_WARN_ENUM_CONVERSION = YES; 398 | CLANG_WARN_INFINITE_RECURSION = YES; 399 | CLANG_WARN_INT_CONVERSION = YES; 400 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 401 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 407 | ENABLE_NS_ASSERTIONS = NO; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 418 | MTL_ENABLE_DEBUG_INFO = NO; 419 | SDKROOT = iphoneos; 420 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 421 | TARGETED_DEVICE_FAMILY = "1,2"; 422 | VALIDATE_PRODUCT = YES; 423 | }; 424 | name = Release; 425 | }; 426 | 75B674C41EE8E1740012155A /* Debug */ = { 427 | isa = XCBuildConfiguration; 428 | buildSettings = { 429 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 430 | DEVELOPMENT_TEAM = 65Y8F76Y6Z; 431 | INFOPLIST_FILE = MMTimeLine_Swift/Info.plist; 432 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 433 | PRODUCT_BUNDLE_IDENTIFIER = "xw.MMTimeLine-Swift"; 434 | PRODUCT_NAME = "$(TARGET_NAME)"; 435 | SWIFT_VERSION = 3.0; 436 | }; 437 | name = Debug; 438 | }; 439 | 75B674C51EE8E1740012155A /* Release */ = { 440 | isa = XCBuildConfiguration; 441 | buildSettings = { 442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 443 | DEVELOPMENT_TEAM = 65Y8F76Y6Z; 444 | INFOPLIST_FILE = MMTimeLine_Swift/Info.plist; 445 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 446 | PRODUCT_BUNDLE_IDENTIFIER = "xw.MMTimeLine-Swift"; 447 | PRODUCT_NAME = "$(TARGET_NAME)"; 448 | SWIFT_VERSION = 3.0; 449 | }; 450 | name = Release; 451 | }; 452 | 75B674C71EE8E1740012155A /* Debug */ = { 453 | isa = XCBuildConfiguration; 454 | buildSettings = { 455 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 456 | BUNDLE_LOADER = "$(TEST_HOST)"; 457 | DEVELOPMENT_TEAM = 65Y8F76Y6Z; 458 | INFOPLIST_FILE = MMTimeLine_SwiftTests/Info.plist; 459 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 460 | PRODUCT_BUNDLE_IDENTIFIER = "xw.MMTimeLine-SwiftTests"; 461 | PRODUCT_NAME = "$(TARGET_NAME)"; 462 | SWIFT_VERSION = 3.0; 463 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MMTimeLine_Swift.app/MMTimeLine_Swift"; 464 | }; 465 | name = Debug; 466 | }; 467 | 75B674C81EE8E1740012155A /* Release */ = { 468 | isa = XCBuildConfiguration; 469 | buildSettings = { 470 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 471 | BUNDLE_LOADER = "$(TEST_HOST)"; 472 | DEVELOPMENT_TEAM = 65Y8F76Y6Z; 473 | INFOPLIST_FILE = MMTimeLine_SwiftTests/Info.plist; 474 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 475 | PRODUCT_BUNDLE_IDENTIFIER = "xw.MMTimeLine-SwiftTests"; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | SWIFT_VERSION = 3.0; 478 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MMTimeLine_Swift.app/MMTimeLine_Swift"; 479 | }; 480 | name = Release; 481 | }; 482 | 75B674CA1EE8E1740012155A /* Debug */ = { 483 | isa = XCBuildConfiguration; 484 | buildSettings = { 485 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 486 | DEVELOPMENT_TEAM = 65Y8F76Y6Z; 487 | INFOPLIST_FILE = MMTimeLine_SwiftUITests/Info.plist; 488 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 489 | PRODUCT_BUNDLE_IDENTIFIER = "xw.MMTimeLine-SwiftUITests"; 490 | PRODUCT_NAME = "$(TARGET_NAME)"; 491 | SWIFT_VERSION = 3.0; 492 | TEST_TARGET_NAME = MMTimeLine_Swift; 493 | }; 494 | name = Debug; 495 | }; 496 | 75B674CB1EE8E1740012155A /* Release */ = { 497 | isa = XCBuildConfiguration; 498 | buildSettings = { 499 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 500 | DEVELOPMENT_TEAM = 65Y8F76Y6Z; 501 | INFOPLIST_FILE = MMTimeLine_SwiftUITests/Info.plist; 502 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 503 | PRODUCT_BUNDLE_IDENTIFIER = "xw.MMTimeLine-SwiftUITests"; 504 | PRODUCT_NAME = "$(TARGET_NAME)"; 505 | SWIFT_VERSION = 3.0; 506 | TEST_TARGET_NAME = MMTimeLine_Swift; 507 | }; 508 | name = Release; 509 | }; 510 | /* End XCBuildConfiguration section */ 511 | 512 | /* Begin XCConfigurationList section */ 513 | 75B674961EE8E1730012155A /* Build configuration list for PBXProject "MMTimeLine_Swift" */ = { 514 | isa = XCConfigurationList; 515 | buildConfigurations = ( 516 | 75B674C11EE8E1740012155A /* Debug */, 517 | 75B674C21EE8E1740012155A /* Release */, 518 | ); 519 | defaultConfigurationIsVisible = 0; 520 | defaultConfigurationName = Release; 521 | }; 522 | 75B674C31EE8E1740012155A /* Build configuration list for PBXNativeTarget "MMTimeLine_Swift" */ = { 523 | isa = XCConfigurationList; 524 | buildConfigurations = ( 525 | 75B674C41EE8E1740012155A /* Debug */, 526 | 75B674C51EE8E1740012155A /* Release */, 527 | ); 528 | defaultConfigurationIsVisible = 0; 529 | }; 530 | 75B674C61EE8E1740012155A /* Build configuration list for PBXNativeTarget "MMTimeLine_SwiftTests" */ = { 531 | isa = XCConfigurationList; 532 | buildConfigurations = ( 533 | 75B674C71EE8E1740012155A /* Debug */, 534 | 75B674C81EE8E1740012155A /* Release */, 535 | ); 536 | defaultConfigurationIsVisible = 0; 537 | }; 538 | 75B674C91EE8E1740012155A /* Build configuration list for PBXNativeTarget "MMTimeLine_SwiftUITests" */ = { 539 | isa = XCConfigurationList; 540 | buildConfigurations = ( 541 | 75B674CA1EE8E1740012155A /* Debug */, 542 | 75B674CB1EE8E1740012155A /* Release */, 543 | ); 544 | defaultConfigurationIsVisible = 0; 545 | }; 546 | /* End XCConfigurationList section */ 547 | }; 548 | rootObject = 75B674931EE8E1730012155A /* Project object */; 549 | } 550 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift.xcodeproj/project.xcworkspace/xcuserdata/wyy.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YYWDark/MMTimeLine/ce902c897dea4868a4a321704c4e9b5dacdddf39/MMTimeLine_Swift/MMTimeLine_Swift.xcodeproj/project.xcworkspace/xcuserdata/wyy.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift.xcodeproj/xcuserdata/wyy.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift.xcodeproj/xcuserdata/wyy.xcuserdatad/xcschemes/MMTimeLine_Swift.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift.xcodeproj/xcuserdata/wyy.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MMTimeLine_Swift.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 75B6749A1EE8E1730012155A 16 | 17 | primary 18 | 19 | 20 | 75B674AE1EE8E1740012155A 21 | 22 | primary 23 | 24 | 25 | 75B674B91EE8E1740012155A 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // MMTimeLine_Swift 4 | // 5 | // Created by wyy on 2017/6/8. 6 | // Copyright © 2017年 wyy. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | let kScreenRect: CGRect = UIScreen.main.bounds 11 | let kScreenWidth: CGFloat = UIScreen.main.bounds.size.width 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 19 | // Override point for customization after application launch. 20 | return true 21 | } 22 | 23 | func applicationWillResignActive(_ application: UIApplication) { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 26 | } 27 | 28 | func applicationDidEnterBackground(_ application: UIApplication) { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | func applicationWillEnterForeground(_ application: UIApplication) { 34 | // 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. 35 | } 36 | 37 | func applicationDidBecomeActive(_ application: UIApplication) { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | func applicationWillTerminate(_ application: UIApplication) { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | 46 | } 47 | 48 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift/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 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift/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 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift/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 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift/MMTimeLineCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MMTimeLineCell.swift 3 | // MMTimeLine_Swift 4 | // 5 | // Created by wyy on 2017/6/8. 6 | // Copyright © 2017年 wyy. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol MMTimeLineCellDelegate: class { 12 | func orderTrackingCellDidFnishedLoad(cell: MMTimeLineCell) 13 | } 14 | 15 | class MMTimeLineCell: UITableViewCell { 16 | let blueColor = UIColor.init(red: 82.0/255.0, green: 116.0/255.0, blue: 188.0/255.0, alpha: 1.0) 17 | let timeLabel = UILabel() 18 | let contentLabel = UILabel(); 19 | var lineLayer = CAShapeLayer() 20 | var layout: MMTimeLineLayout? 21 | weak var delegate: MMTimeLineCellDelegate? 22 | 23 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) { 24 | super.init(style: style, reuseIdentifier: reuseIdentifier) 25 | setUpView() 26 | } 27 | 28 | required init?(coder aDecoder: NSCoder) { 29 | fatalError("init(coder:) has not been implemented") 30 | } 31 | 32 | override func layoutSubviews() { 33 | super.layoutSubviews() 34 | self.timeLabel.frame = (self.layout?.timeLabelRect)! 35 | self.contentLabel.frame = (self.layout?.contentLabelRect)! 36 | 37 | //已经加载过了,防止复用,重复动画 38 | if (layout?.model.iscellAlreadyLoad)! { 39 | self.lineLayer.path = animationPath() 40 | } else { 41 | animationLayer() 42 | delegate?.orderTrackingCellDidFnishedLoad(cell: self) 43 | } 44 | } 45 | 46 | func setUpView() { 47 | timeLabel.textColor = UIColor.black 48 | timeLabel.textAlignment = .right 49 | contentView.addSubview(timeLabel) 50 | 51 | contentLabel.numberOfLines = 0 52 | contentLabel.backgroundColor = blueColor 53 | contentLabel.textColor = UIColor.white 54 | contentView.addSubview(contentLabel) 55 | 56 | lineLayer.fillColor = UIColor.clear.cgColor 57 | lineLayer.strokeColor = blueColor.cgColor 58 | lineLayer.lineWidth = 1.0 59 | lineLayer.autoreverses = false 60 | contentView.layer.addSublayer(lineLayer) 61 | } 62 | 63 | func configurationCell(layout: MMTimeLineLayout) { 64 | self.layout = layout 65 | timeLabel.font = UIFont.systemFont(ofSize: layout.timeLabelFont) 66 | contentLabel.font = UIFont.systemFont(ofSize: layout.contentLableFont) 67 | timeLabel.text = layout.model.orderTime as String 68 | contentLabel.text = layout.model.textContent as String 69 | } 70 | 71 | //MARK -- CAShapeLayer 72 | func animationPath() -> CGPath { 73 | let point_x = (self.layout?.linePositionX)! 74 | 75 | let bezierPath = UIBezierPath() 76 | bezierPath.move(to: CGPoint(x: point_x, y: 0)) 77 | 78 | let point_y = ((self.layout?.timeLabelRect.size.height)!/2) + (self.layout?.verticalDistance)! 79 | 80 | let radius: CGFloat = 3.0 81 | bezierPath.addLine(to: CGPoint(x: (self.layout?.linePositionX)!, y: point_y - radius)) 82 | 83 | bezierPath.addArc(withCenter: CGPoint(x: point_x, y: point_y), radius: radius, startAngle: degreesToRadian(-90), endAngle: degreesToRadian(450), clockwise: true) 84 | 85 | bezierPath.addLine(to: CGPoint(x: point_x, y: (self.layout?.totalHeight)!)) 86 | print((self.layout?.totalHeight)!) 87 | return bezierPath.cgPath 88 | 89 | } 90 | 91 | func degreesToRadian(_ degrees: CGFloat) -> CGFloat { 92 | return (CGFloat.pi * degrees) / 180.0 93 | } 94 | 95 | func animationLayer() { 96 | let animation = CABasicAnimation(keyPath: "strokeEnd") 97 | animation.fromValue = 0.0 98 | animation.toValue = 1.0 99 | animation.duration = AnimationDuring 100 | self.lineLayer.path = animationPath() 101 | self.lineLayer.add(animation, forKey: nil) 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift/MMTimeLineLayout.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MMTimeLineLayout.swift 3 | // MMTimeLine_Swift 4 | // 5 | // Created by wyy on 2017/6/8. 6 | // Copyright © 2017年 wyy. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension String { 12 | func heightWithConstraintWidth(constraintWidth: CGFloat, font: UIFont) -> CGFloat { 13 | let constraintRect = CGSize(width: constraintWidth, height: CGFloat.greatestFiniteMagnitude) 14 | let boundingBox = self.boundingRect(with: constraintRect, options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: [NSFontAttributeName: font], context: nil) 15 | return boundingBox.height 16 | } 17 | } 18 | 19 | class MMTimeLineLayout: NSObject { 20 | var timeLabelRect = CGRect.zero 21 | var contentLabelRect = CGRect.zero 22 | var totalHeight: CGFloat = 0.0 23 | let timeLabelFont: CGFloat = 12.0 24 | let contentLableFont: CGFloat = 14.0 25 | var linePositionX: CGFloat = 0.0 26 | let verticalDistance: CGFloat = 15.0 27 | let horizontalDistance: CGFloat = 15.0 28 | let model: MMTimeLineModel 29 | 30 | public init(model: MMTimeLineModel) { 31 | self.model = model 32 | super.init(); 33 | self.layoutWithModel(model: model) 34 | } 35 | 36 | required init?(coder aDecoder: NSCoder) { 37 | fatalError("init(coder:) has not been implemented") 38 | } 39 | 40 | func layoutWithModel(model: MMTimeLineModel) { 41 | 42 | let timeLabelWidth: CGFloat = 60.0 43 | 44 | timeLabelRect = CGRect(x: horizontalDistance, y: verticalDistance, width: timeLabelWidth, height: 20.0) 45 | let contentLabelWidth = kScreenWidth - timeLabelRect.size.width - 3 * horizontalDistance 46 | let contentLabelHeight = (model.textContent as String).heightWithConstraintWidth(constraintWidth: contentLabelWidth, font: UIFont.systemFont(ofSize: contentLableFont)) + 10.0 47 | 48 | contentLabelRect = CGRect(x: timeLabelRect.size.width + 2 * horizontalDistance, y: verticalDistance, width: contentLabelWidth, height: contentLabelHeight) 49 | 50 | linePositionX = horizontalDistance + timeLabelWidth + horizontalDistance/2 51 | //计算高度 52 | totalHeight += verticalDistance 53 | totalHeight += max(timeLabelRect.size.height, contentLabelRect.size.height) 54 | totalHeight += verticalDistance 55 | } 56 | 57 | } 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift/MMTimeLineModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XRTTimeLineModel.swift 3 | // MMTimeLine_Swift 4 | // 5 | // Created by wyy on 2017/6/8. 6 | // Copyright © 2017年 wyy. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class MMTimeLineModel: NSObject { 12 | var iscellAlreadyLoad = false 13 | var orderTime: NSString 14 | var textContent: NSString 15 | 16 | init(_ orderTime: NSString, _ textContent: NSString) { 17 | self.orderTime = orderTime 18 | self.textContent = textContent 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_Swift/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // MMTimeLine_Swift 4 | // 5 | // Created by wyy on 2017/6/8. 6 | // Copyright © 2017年 wyy. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | let CellID = "MMTimeLineCell" 12 | let AnimationDuring = 0.5 13 | 14 | class ViewController: UIViewController { 15 | var sourceArray: [MMTimeLineModel] = [ 16 | MMTimeLineModel("8:00","1: 上班打卡"), 17 | MMTimeLineModel("8:30","2: 今天天气不错呢,美好的一天。"), 18 | MMTimeLineModel("9:00","3: 开始要工作了呢,今天要做好多事请,先列个计划吧,嗯,开始工作。为了加长这个字符串,继续写以下废话,废话很多,用来占位置的,方便测试,嘻嘻哈哈,(*^__^*) 嘻嘻……"), 19 | MMTimeLineModel("9:30","4: 开一会儿小差吧,吃个点心啥的"), 20 | MMTimeLineModel("10:00","5: 哦,还有好多工作啊,别吃了"), 21 | MMTimeLineModel("10:30","6: 嗯,休息时间到了,今天是睡觉呢还是玩儿游戏呢,这是个问题,还是先玩一会游戏吧"), 22 | MMTimeLineModel("11:00","7: 继续工作,坑爹了,这个bug不好解决呀"), 23 | MMTimeLineModel("11:30","8: 先热个饭"), 24 | MMTimeLineModel("12:00","9: 吃饭,散步,一条龙"), 25 | MMTimeLineModel("12:30","10: 看会NBA,骑士这都能输?看来这周就要结束总决赛了"), 26 | MMTimeLineModel("13:00","11: 睡觉,想妹子"), 27 | MMTimeLineModel("14:00","12: 起来做事,bug修不完回不了家"), 28 | MMTimeLineModel("15:00","13: 下午茶时间到了,拿根香蕉和牛奶吧,反正也没有什么好吃的"), 29 | MMTimeLineModel("16:00","14: 继续工作"), 30 | MMTimeLineModel("17:00","15: 赶紧做完事情,免得又要加班。"), 31 | MMTimeLineModel("18:00","16: 约妹子吃饭看电影打豆豆一起学习swift,少壮不努力,老大喜当爹"), 32 | MMTimeLineModel("23:00","17: 至今思项羽,不肯喜当爹。睡觉"), 33 | ] 34 | var dataArrays:[MMTimeLineLayout] = [] 35 | let tableView = UITableView(frame: kScreenRect, style: .plain) 36 | 37 | override func viewDidLoad() { 38 | super.viewDidLoad() 39 | setUpSubViews() 40 | animationDisplay() 41 | } 42 | 43 | override func didReceiveMemoryWarning() { 44 | super.didReceiveMemoryWarning() 45 | 46 | } 47 | 48 | //MARK: -- Private Method 49 | func requesetData() { 50 | sourceArray.forEach { (model) in 51 | dataArrays.append(MMTimeLineLayout.init(model: model)) 52 | } 53 | } 54 | 55 | func setUpSubViews() { 56 | tableView.delegate = self 57 | tableView.dataSource = self 58 | tableView.register(MMTimeLineCell.classForCoder(), forCellReuseIdentifier: CellID) 59 | tableView.tableFooterView = UIView() 60 | self.view.addSubview(tableView) 61 | } 62 | 63 | func animationDisplay() { 64 | if self.dataArrays.count >= self.sourceArray.count { 65 | return 66 | } 67 | let model = self.sourceArray[self.dataArrays.count] 68 | dataArrays.append(MMTimeLineLayout.init(model: model)) 69 | // self.sourceArray.remove(at: 0) 70 | 71 | let lastIndexPath = NSIndexPath(row: (self.dataArrays.count - 1), section: 0) as IndexPath 72 | self.tableView.beginUpdates() 73 | self.tableView.insertRows(at: [lastIndexPath], with: .none) 74 | self.tableView.endUpdates() 75 | self.tableView.scrollToRow(at: lastIndexPath, at: .bottom, animated: true) 76 | self.tableView.separatorStyle = .none; 77 | DispatchQueue.main.asyncAfter(deadline: .now() + AnimationDuring) { 78 | self.animationDisplay() 79 | } 80 | } 81 | } 82 | //MARK: -- MMTimeLineCellDelegate 83 | extension ViewController: MMTimeLineCellDelegate { 84 | func orderTrackingCellDidFnishedLoad(cell: MMTimeLineCell) { 85 | let layout = self.dataArrays[cell.tag] 86 | layout.model.iscellAlreadyLoad = true 87 | } 88 | } 89 | 90 | //MARK: -- UITableViewDelegate 91 | extension ViewController: UITableViewDelegate { 92 | func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { 93 | let timeLineCell = (cell as!MMTimeLineCell) 94 | timeLineCell.configurationCell(layout: self.dataArrays[indexPath.row]) 95 | timeLineCell.tag = indexPath.row 96 | timeLineCell.delegate = self 97 | } 98 | 99 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 100 | return self.dataArrays[indexPath.row].totalHeight 101 | } 102 | } 103 | 104 | //MARK: -- UITableViewDataSource 105 | extension ViewController: UITableViewDataSource { 106 | public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 107 | return dataArrays.count 108 | } 109 | 110 | public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 111 | let cell = tableView.dequeueReusableCell(withIdentifier: CellID, for: indexPath) as!MMTimeLineCell 112 | return cell 113 | } 114 | } 115 | 116 | 117 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_SwiftTests/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 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_SwiftTests/MMTimeLine_SwiftTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MMTimeLine_SwiftTests.swift 3 | // MMTimeLine_SwiftTests 4 | // 5 | // Created by wyy on 2017/6/8. 6 | // Copyright © 2017年 wyy. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import MMTimeLine_Swift 11 | 12 | class MMTimeLine_SwiftTests: 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 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_SwiftUITests/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 | -------------------------------------------------------------------------------- /MMTimeLine_Swift/MMTimeLine_SwiftUITests/MMTimeLine_SwiftUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MMTimeLine_SwiftUITests.swift 3 | // MMTimeLine_SwiftUITests 4 | // 5 | // Created by wyy on 2017/6/8. 6 | // Copyright © 2017年 wyy. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class MMTimeLine_SwiftUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ![1112.gif](http://upload-images.jianshu.io/upload_images/307963-eb4ab88df0afd22e.gif?imageMogr2/auto-orient/strip) 4 | --------------------------------------------------------------------------------