├── README.md └── TiktokSwiftUI ├── TiktokSwiftUI.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── giresh.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── giresh.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist └── TiktokSwiftUI ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json ├── Contents.json ├── comment.imageset │ ├── Contents.json │ └── comment.png ├── home.imageset │ ├── Contents.json │ └── home.png ├── pic.imageset │ ├── Contents.json │ └── pic.jpeg ├── profile.imageset │ ├── Contents.json │ └── profile.png ├── search.imageset │ ├── Contents.json │ └── search.png └── upload.imageset │ ├── Contents.json │ └── upload.png ├── Base.lproj └── LaunchScreen.storyboard ├── Info.plist ├── Modal └── Video.swift ├── Preview Content └── Preview Assets.xcassets │ └── Contents.json ├── SceneDelegate.swift ├── Views ├── ContentView.swift ├── Player.swift ├── PlayerScrollView.swift └── PlayerView.swift ├── video1.mp4 ├── video2.mp4 ├── video3.mp4 ├── video4.mp4 ├── video5.mp4 └── video6.mp4 /README.md: -------------------------------------------------------------------------------- 1 | # TiktokSwiftUI 2 | Tiktok SwiftUI demo 3 | 4 | 5 | ![Simulator Screen Shot - iPhone 11 Pro Max - 2020-06-14 at 09 40 23](https://user-images.githubusercontent.com/32384820/84584529-266d3100-ae23-11ea-90c4-e70de6053d6f.png) 6 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6E0277D424953A0A00A7AA08 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E0277D324953A0A00A7AA08 /* AppDelegate.swift */; }; 11 | 6E0277D624953A0A00A7AA08 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E0277D524953A0A00A7AA08 /* SceneDelegate.swift */; }; 12 | 6E0277D824953A0A00A7AA08 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E0277D724953A0A00A7AA08 /* ContentView.swift */; }; 13 | 6E0277DA24953A0C00A7AA08 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6E0277D924953A0C00A7AA08 /* Assets.xcassets */; }; 14 | 6E0277DD24953A0C00A7AA08 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6E0277DC24953A0C00A7AA08 /* Preview Assets.xcassets */; }; 15 | 6E0277E024953A0C00A7AA08 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6E0277DE24953A0C00A7AA08 /* LaunchScreen.storyboard */; }; 16 | 6E0277E82495453100A7AA08 /* Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E0277E72495453100A7AA08 /* Video.swift */; }; 17 | 6E0277EF249545DC00A7AA08 /* video1.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 6E0277E9249545DC00A7AA08 /* video1.mp4 */; }; 18 | 6E0277F0249545DC00A7AA08 /* video4.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 6E0277EA249545DC00A7AA08 /* video4.mp4 */; }; 19 | 6E0277F1249545DC00A7AA08 /* video2.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 6E0277EB249545DC00A7AA08 /* video2.mp4 */; }; 20 | 6E0277F2249545DC00A7AA08 /* video5.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 6E0277EC249545DC00A7AA08 /* video5.mp4 */; }; 21 | 6E0277F3249545DC00A7AA08 /* video6.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 6E0277ED249545DC00A7AA08 /* video6.mp4 */; }; 22 | 6E0277F4249545DC00A7AA08 /* video3.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 6E0277EE249545DC00A7AA08 /* video3.mp4 */; }; 23 | 6E0277F72495D84F00A7AA08 /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E0277F62495D84F00A7AA08 /* Player.swift */; }; 24 | 6E0277F92495D88300A7AA08 /* PlayerScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E0277F82495D88300A7AA08 /* PlayerScrollView.swift */; }; 25 | 6E0277FB2495D8B000A7AA08 /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E0277FA2495D8B000A7AA08 /* PlayerView.swift */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 6E0277D024953A0A00A7AA08 /* TiktokSwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TiktokSwiftUI.app; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 6E0277D324953A0A00A7AA08 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 31 | 6E0277D524953A0A00A7AA08 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 32 | 6E0277D724953A0A00A7AA08 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 33 | 6E0277D924953A0C00A7AA08 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 34 | 6E0277DC24953A0C00A7AA08 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 35 | 6E0277DF24953A0C00A7AA08 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 36 | 6E0277E124953A0C00A7AA08 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | 6E0277E72495453100A7AA08 /* Video.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Video.swift; sourceTree = ""; }; 38 | 6E0277E9249545DC00A7AA08 /* video1.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = video1.mp4; sourceTree = ""; }; 39 | 6E0277EA249545DC00A7AA08 /* video4.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = video4.mp4; sourceTree = ""; }; 40 | 6E0277EB249545DC00A7AA08 /* video2.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = video2.mp4; sourceTree = ""; }; 41 | 6E0277EC249545DC00A7AA08 /* video5.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = video5.mp4; sourceTree = ""; }; 42 | 6E0277ED249545DC00A7AA08 /* video6.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = video6.mp4; sourceTree = ""; }; 43 | 6E0277EE249545DC00A7AA08 /* video3.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = video3.mp4; sourceTree = ""; }; 44 | 6E0277F62495D84F00A7AA08 /* Player.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Player.swift; sourceTree = ""; }; 45 | 6E0277F82495D88300A7AA08 /* PlayerScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerScrollView.swift; sourceTree = ""; }; 46 | 6E0277FA2495D8B000A7AA08 /* PlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerView.swift; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 6E0277CD24953A0A00A7AA08 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | 6E0277C724953A0A00A7AA08 = { 61 | isa = PBXGroup; 62 | children = ( 63 | 6E0277D224953A0A00A7AA08 /* TiktokSwiftUI */, 64 | 6E0277D124953A0A00A7AA08 /* Products */, 65 | ); 66 | sourceTree = ""; 67 | }; 68 | 6E0277D124953A0A00A7AA08 /* Products */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 6E0277D024953A0A00A7AA08 /* TiktokSwiftUI.app */, 72 | ); 73 | name = Products; 74 | sourceTree = ""; 75 | }; 76 | 6E0277D224953A0A00A7AA08 /* TiktokSwiftUI */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 6E0277D324953A0A00A7AA08 /* AppDelegate.swift */, 80 | 6E0277D524953A0A00A7AA08 /* SceneDelegate.swift */, 81 | 6E0277FC2495D92100A7AA08 /* Modal */, 82 | 6E0277F52495D83500A7AA08 /* Views */, 83 | 6E0277D924953A0C00A7AA08 /* Assets.xcassets */, 84 | 6E0277DE24953A0C00A7AA08 /* LaunchScreen.storyboard */, 85 | 6E0277E124953A0C00A7AA08 /* Info.plist */, 86 | 6E0277E9249545DC00A7AA08 /* video1.mp4 */, 87 | 6E0277EB249545DC00A7AA08 /* video2.mp4 */, 88 | 6E0277EE249545DC00A7AA08 /* video3.mp4 */, 89 | 6E0277EA249545DC00A7AA08 /* video4.mp4 */, 90 | 6E0277EC249545DC00A7AA08 /* video5.mp4 */, 91 | 6E0277ED249545DC00A7AA08 /* video6.mp4 */, 92 | 6E0277DB24953A0C00A7AA08 /* Preview Content */, 93 | ); 94 | path = TiktokSwiftUI; 95 | sourceTree = ""; 96 | }; 97 | 6E0277DB24953A0C00A7AA08 /* Preview Content */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 6E0277DC24953A0C00A7AA08 /* Preview Assets.xcassets */, 101 | ); 102 | path = "Preview Content"; 103 | sourceTree = ""; 104 | }; 105 | 6E0277F52495D83500A7AA08 /* Views */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 6E0277D724953A0A00A7AA08 /* ContentView.swift */, 109 | 6E0277F62495D84F00A7AA08 /* Player.swift */, 110 | 6E0277F82495D88300A7AA08 /* PlayerScrollView.swift */, 111 | 6E0277FA2495D8B000A7AA08 /* PlayerView.swift */, 112 | ); 113 | path = Views; 114 | sourceTree = ""; 115 | }; 116 | 6E0277FC2495D92100A7AA08 /* Modal */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 6E0277E72495453100A7AA08 /* Video.swift */, 120 | ); 121 | path = Modal; 122 | sourceTree = ""; 123 | }; 124 | /* End PBXGroup section */ 125 | 126 | /* Begin PBXNativeTarget section */ 127 | 6E0277CF24953A0A00A7AA08 /* TiktokSwiftUI */ = { 128 | isa = PBXNativeTarget; 129 | buildConfigurationList = 6E0277E424953A0C00A7AA08 /* Build configuration list for PBXNativeTarget "TiktokSwiftUI" */; 130 | buildPhases = ( 131 | 6E0277CC24953A0A00A7AA08 /* Sources */, 132 | 6E0277CD24953A0A00A7AA08 /* Frameworks */, 133 | 6E0277CE24953A0A00A7AA08 /* Resources */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | ); 139 | name = TiktokSwiftUI; 140 | productName = TiktokSwiftUI; 141 | productReference = 6E0277D024953A0A00A7AA08 /* TiktokSwiftUI.app */; 142 | productType = "com.apple.product-type.application"; 143 | }; 144 | /* End PBXNativeTarget section */ 145 | 146 | /* Begin PBXProject section */ 147 | 6E0277C824953A0A00A7AA08 /* Project object */ = { 148 | isa = PBXProject; 149 | attributes = { 150 | LastSwiftUpdateCheck = 1130; 151 | LastUpgradeCheck = 1130; 152 | ORGANIZATIONNAME = Giresh; 153 | TargetAttributes = { 154 | 6E0277CF24953A0A00A7AA08 = { 155 | CreatedOnToolsVersion = 11.3.1; 156 | }; 157 | }; 158 | }; 159 | buildConfigurationList = 6E0277CB24953A0A00A7AA08 /* Build configuration list for PBXProject "TiktokSwiftUI" */; 160 | compatibilityVersion = "Xcode 9.3"; 161 | developmentRegion = en; 162 | hasScannedForEncodings = 0; 163 | knownRegions = ( 164 | en, 165 | Base, 166 | ); 167 | mainGroup = 6E0277C724953A0A00A7AA08; 168 | productRefGroup = 6E0277D124953A0A00A7AA08 /* Products */; 169 | projectDirPath = ""; 170 | projectRoot = ""; 171 | targets = ( 172 | 6E0277CF24953A0A00A7AA08 /* TiktokSwiftUI */, 173 | ); 174 | }; 175 | /* End PBXProject section */ 176 | 177 | /* Begin PBXResourcesBuildPhase section */ 178 | 6E0277CE24953A0A00A7AA08 /* Resources */ = { 179 | isa = PBXResourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 6E0277E024953A0C00A7AA08 /* LaunchScreen.storyboard in Resources */, 183 | 6E0277F4249545DC00A7AA08 /* video3.mp4 in Resources */, 184 | 6E0277EF249545DC00A7AA08 /* video1.mp4 in Resources */, 185 | 6E0277F1249545DC00A7AA08 /* video2.mp4 in Resources */, 186 | 6E0277DD24953A0C00A7AA08 /* Preview Assets.xcassets in Resources */, 187 | 6E0277F2249545DC00A7AA08 /* video5.mp4 in Resources */, 188 | 6E0277F0249545DC00A7AA08 /* video4.mp4 in Resources */, 189 | 6E0277F3249545DC00A7AA08 /* video6.mp4 in Resources */, 190 | 6E0277DA24953A0C00A7AA08 /* Assets.xcassets in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXSourcesBuildPhase section */ 197 | 6E0277CC24953A0A00A7AA08 /* Sources */ = { 198 | isa = PBXSourcesBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | 6E0277F92495D88300A7AA08 /* PlayerScrollView.swift in Sources */, 202 | 6E0277D424953A0A00A7AA08 /* AppDelegate.swift in Sources */, 203 | 6E0277FB2495D8B000A7AA08 /* PlayerView.swift in Sources */, 204 | 6E0277E82495453100A7AA08 /* Video.swift in Sources */, 205 | 6E0277D624953A0A00A7AA08 /* SceneDelegate.swift in Sources */, 206 | 6E0277F72495D84F00A7AA08 /* Player.swift in Sources */, 207 | 6E0277D824953A0A00A7AA08 /* ContentView.swift in Sources */, 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | /* End PBXSourcesBuildPhase section */ 212 | 213 | /* Begin PBXVariantGroup section */ 214 | 6E0277DE24953A0C00A7AA08 /* LaunchScreen.storyboard */ = { 215 | isa = PBXVariantGroup; 216 | children = ( 217 | 6E0277DF24953A0C00A7AA08 /* Base */, 218 | ); 219 | name = LaunchScreen.storyboard; 220 | sourceTree = ""; 221 | }; 222 | /* End PBXVariantGroup section */ 223 | 224 | /* Begin XCBuildConfiguration section */ 225 | 6E0277E224953A0C00A7AA08 /* Debug */ = { 226 | isa = XCBuildConfiguration; 227 | buildSettings = { 228 | ALWAYS_SEARCH_USER_PATHS = NO; 229 | CLANG_ANALYZER_NONNULL = YES; 230 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 231 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 232 | CLANG_CXX_LIBRARY = "libc++"; 233 | CLANG_ENABLE_MODULES = YES; 234 | CLANG_ENABLE_OBJC_ARC = YES; 235 | CLANG_ENABLE_OBJC_WEAK = YES; 236 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 237 | CLANG_WARN_BOOL_CONVERSION = YES; 238 | CLANG_WARN_COMMA = YES; 239 | CLANG_WARN_CONSTANT_CONVERSION = YES; 240 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 241 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 242 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 243 | CLANG_WARN_EMPTY_BODY = YES; 244 | CLANG_WARN_ENUM_CONVERSION = YES; 245 | CLANG_WARN_INFINITE_RECURSION = YES; 246 | CLANG_WARN_INT_CONVERSION = YES; 247 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 248 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 249 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 250 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 251 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 252 | CLANG_WARN_STRICT_PROTOTYPES = YES; 253 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 254 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 255 | CLANG_WARN_UNREACHABLE_CODE = YES; 256 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 257 | COPY_PHASE_STRIP = NO; 258 | DEBUG_INFORMATION_FORMAT = dwarf; 259 | ENABLE_STRICT_OBJC_MSGSEND = YES; 260 | ENABLE_TESTABILITY = YES; 261 | GCC_C_LANGUAGE_STANDARD = gnu11; 262 | GCC_DYNAMIC_NO_PIC = NO; 263 | GCC_NO_COMMON_BLOCKS = YES; 264 | GCC_OPTIMIZATION_LEVEL = 0; 265 | GCC_PREPROCESSOR_DEFINITIONS = ( 266 | "DEBUG=1", 267 | "$(inherited)", 268 | ); 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 276 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 277 | MTL_FAST_MATH = YES; 278 | ONLY_ACTIVE_ARCH = YES; 279 | SDKROOT = iphoneos; 280 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 281 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 282 | }; 283 | name = Debug; 284 | }; 285 | 6E0277E324953A0C00A7AA08 /* Release */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ALWAYS_SEARCH_USER_PATHS = NO; 289 | CLANG_ANALYZER_NONNULL = YES; 290 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 291 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 292 | CLANG_CXX_LIBRARY = "libc++"; 293 | CLANG_ENABLE_MODULES = YES; 294 | CLANG_ENABLE_OBJC_ARC = YES; 295 | CLANG_ENABLE_OBJC_WEAK = YES; 296 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 297 | CLANG_WARN_BOOL_CONVERSION = YES; 298 | CLANG_WARN_COMMA = YES; 299 | CLANG_WARN_CONSTANT_CONVERSION = YES; 300 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 301 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 302 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 303 | CLANG_WARN_EMPTY_BODY = YES; 304 | CLANG_WARN_ENUM_CONVERSION = YES; 305 | CLANG_WARN_INFINITE_RECURSION = YES; 306 | CLANG_WARN_INT_CONVERSION = YES; 307 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 308 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 309 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 310 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 311 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 312 | CLANG_WARN_STRICT_PROTOTYPES = YES; 313 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 314 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 315 | CLANG_WARN_UNREACHABLE_CODE = YES; 316 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 317 | COPY_PHASE_STRIP = NO; 318 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 319 | ENABLE_NS_ASSERTIONS = NO; 320 | ENABLE_STRICT_OBJC_MSGSEND = YES; 321 | GCC_C_LANGUAGE_STANDARD = gnu11; 322 | GCC_NO_COMMON_BLOCKS = YES; 323 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 324 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 325 | GCC_WARN_UNDECLARED_SELECTOR = YES; 326 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 327 | GCC_WARN_UNUSED_FUNCTION = YES; 328 | GCC_WARN_UNUSED_VARIABLE = YES; 329 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 330 | MTL_ENABLE_DEBUG_INFO = NO; 331 | MTL_FAST_MATH = YES; 332 | SDKROOT = iphoneos; 333 | SWIFT_COMPILATION_MODE = wholemodule; 334 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 335 | VALIDATE_PRODUCT = YES; 336 | }; 337 | name = Release; 338 | }; 339 | 6E0277E524953A0C00A7AA08 /* Debug */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 343 | CODE_SIGN_STYLE = Automatic; 344 | DEVELOPMENT_ASSET_PATHS = "\"TiktokSwiftUI/Preview Content\""; 345 | DEVELOPMENT_TEAM = 98GS3FJG3C; 346 | ENABLE_PREVIEWS = YES; 347 | INFOPLIST_FILE = TiktokSwiftUI/Info.plist; 348 | LD_RUNPATH_SEARCH_PATHS = ( 349 | "$(inherited)", 350 | "@executable_path/Frameworks", 351 | ); 352 | PRODUCT_BUNDLE_IDENTIFIER = com.TiktokSwiftUI; 353 | PRODUCT_NAME = "$(TARGET_NAME)"; 354 | SWIFT_VERSION = 5.0; 355 | TARGETED_DEVICE_FAMILY = "1,2"; 356 | }; 357 | name = Debug; 358 | }; 359 | 6E0277E624953A0C00A7AA08 /* Release */ = { 360 | isa = XCBuildConfiguration; 361 | buildSettings = { 362 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 363 | CODE_SIGN_STYLE = Automatic; 364 | DEVELOPMENT_ASSET_PATHS = "\"TiktokSwiftUI/Preview Content\""; 365 | DEVELOPMENT_TEAM = 98GS3FJG3C; 366 | ENABLE_PREVIEWS = YES; 367 | INFOPLIST_FILE = TiktokSwiftUI/Info.plist; 368 | LD_RUNPATH_SEARCH_PATHS = ( 369 | "$(inherited)", 370 | "@executable_path/Frameworks", 371 | ); 372 | PRODUCT_BUNDLE_IDENTIFIER = com.TiktokSwiftUI; 373 | PRODUCT_NAME = "$(TARGET_NAME)"; 374 | SWIFT_VERSION = 5.0; 375 | TARGETED_DEVICE_FAMILY = "1,2"; 376 | }; 377 | name = Release; 378 | }; 379 | /* End XCBuildConfiguration section */ 380 | 381 | /* Begin XCConfigurationList section */ 382 | 6E0277CB24953A0A00A7AA08 /* Build configuration list for PBXProject "TiktokSwiftUI" */ = { 383 | isa = XCConfigurationList; 384 | buildConfigurations = ( 385 | 6E0277E224953A0C00A7AA08 /* Debug */, 386 | 6E0277E324953A0C00A7AA08 /* Release */, 387 | ); 388 | defaultConfigurationIsVisible = 0; 389 | defaultConfigurationName = Release; 390 | }; 391 | 6E0277E424953A0C00A7AA08 /* Build configuration list for PBXNativeTarget "TiktokSwiftUI" */ = { 392 | isa = XCConfigurationList; 393 | buildConfigurations = ( 394 | 6E0277E524953A0C00A7AA08 /* Debug */, 395 | 6E0277E624953A0C00A7AA08 /* Release */, 396 | ); 397 | defaultConfigurationIsVisible = 0; 398 | defaultConfigurationName = Release; 399 | }; 400 | /* End XCConfigurationList section */ 401 | }; 402 | rootObject = 6E0277C824953A0A00A7AA08 /* Project object */; 403 | } 404 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI.xcodeproj/project.xcworkspace/xcuserdata/giresh.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GireshD/TiktokSwiftUI/8869d0135cdcd34f8b84904fe858c0ad21d294a3/TiktokSwiftUI/TiktokSwiftUI.xcodeproj/project.xcworkspace/xcuserdata/giresh.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI.xcodeproj/xcuserdata/giresh.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TiktokSwiftUI.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // TiktokSwiftUI 4 | // 5 | // Created by Giresh Dora on 13/06/20. 6 | // Copyright © 2020 Giresh. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/comment.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "comment.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/comment.imageset/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GireshD/TiktokSwiftUI/8869d0135cdcd34f8b84904fe858c0ad21d294a3/TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/comment.imageset/comment.png -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/home.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "home.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/home.imageset/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GireshD/TiktokSwiftUI/8869d0135cdcd34f8b84904fe858c0ad21d294a3/TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/home.imageset/home.png -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/pic.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "pic.jpeg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/pic.imageset/pic.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GireshD/TiktokSwiftUI/8869d0135cdcd34f8b84904fe858c0ad21d294a3/TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/pic.imageset/pic.jpeg -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/profile.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "profile.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/profile.imageset/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GireshD/TiktokSwiftUI/8869d0135cdcd34f8b84904fe858c0ad21d294a3/TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/profile.imageset/profile.png -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/search.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "search.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/search.imageset/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GireshD/TiktokSwiftUI/8869d0135cdcd34f8b84904fe858c0ad21d294a3/TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/search.imageset/search.png -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/upload.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "upload.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/upload.imageset/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GireshD/TiktokSwiftUI/8869d0135cdcd34f8b84904fe858c0ad21d294a3/TiktokSwiftUI/TiktokSwiftUI/Assets.xcassets/upload.imageset/upload.png -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/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 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Modal/Video.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Video.swift 3 | // TiktokSwiftUI 4 | // 5 | // Created by Giresh Dora on 13/06/20. 6 | // Copyright © 2020 Giresh. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import AVKit 11 | 12 | struct Video: Identifiable { 13 | 14 | var id: Int 15 | var player: AVPlayer 16 | var replay: Bool 17 | } 18 | 19 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // TiktokSwiftUI 4 | // 5 | // Created by Giresh Dora on 13/06/20. 6 | // Copyright © 2020 Giresh. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 18 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 19 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 20 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 21 | 22 | // Create the SwiftUI view that provides the window contents. 23 | let contentView = ContentView() 24 | 25 | // Use a UIHostingController as window root view controller. 26 | if let windowScene = scene as? UIWindowScene { 27 | let window = UIWindow(windowScene: windowScene) 28 | window.rootViewController = Host(rootView: contentView) 29 | self.window = window 30 | window.makeKeyAndVisible() 31 | } 32 | } 33 | 34 | func sceneDidDisconnect(_ scene: UIScene) { 35 | // Called as the scene is being released by the system. 36 | // This occurs shortly after the scene enters the background, or when its session is discarded. 37 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 38 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 39 | } 40 | 41 | func sceneDidBecomeActive(_ scene: UIScene) { 42 | // Called when the scene has moved from an inactive state to an active state. 43 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 44 | } 45 | 46 | func sceneWillResignActive(_ scene: UIScene) { 47 | // Called when the scene will move from an active state to an inactive state. 48 | // This may occur due to temporary interruptions (ex. an incoming phone call). 49 | } 50 | 51 | func sceneWillEnterForeground(_ scene: UIScene) { 52 | // Called as the scene transitions from the background to the foreground. 53 | // Use this method to undo the changes made on entering the background. 54 | } 55 | 56 | func sceneDidEnterBackground(_ scene: UIScene) { 57 | // Called as the scene transitions from the foreground to the background. 58 | // Use this method to save data, release shared resources, and store enough scene-specific state information 59 | // to restore the scene back to its current state. 60 | } 61 | 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Views/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // TiktokSwiftUI 4 | // 5 | // Created by Giresh Dora on 13/06/20. 6 | // Copyright © 2020 Giresh. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import AVKit 11 | 12 | struct ContentView: View { 13 | @State var data = [ 14 | 15 | Video(id: 0, player: AVPlayer(url: URL(fileURLWithPath: Bundle.main.path(forResource: "video4", ofType: "mp4")!)), replay: false), 16 | Video(id: 1, player: AVPlayer(url: URL(fileURLWithPath: Bundle.main.path(forResource: "video5", ofType: "mp4")!)), replay: false), 17 | Video(id: 2, player: AVPlayer(url: URL(fileURLWithPath: Bundle.main.path(forResource: "video2", ofType: "mp4")!)), replay: false), 18 | Video(id: 3, player: AVPlayer(url: URL(fileURLWithPath: Bundle.main.path(forResource: "video3", ofType: "mp4")!)), replay: false), 19 | Video(id: 4, player: AVPlayer(url: URL(fileURLWithPath: Bundle.main.path(forResource: "video1", ofType: "mp4")!)), replay: false), 20 | Video(id: 5, player: AVPlayer(url: URL(fileURLWithPath: Bundle.main.path(forResource: "video6", ofType: "mp4")!)), replay: false), 21 | ] 22 | 23 | var body: some View { 24 | ZStack{ 25 | 26 | PlayerScrollView(data: self.$data) 27 | 28 | VStack{ 29 | 30 | TopTabBar() 31 | 32 | Spacer() 33 | 34 | RightTabBar() 35 | 36 | TabBar() 37 | } 38 | .padding(.top, UIApplication.shared.windows.first?.safeAreaInsets.top) 39 | .padding(.bottom, (UIApplication.shared.windows.first?.safeAreaInsets.bottom)! + 5) 40 | 41 | 42 | } 43 | .background(Color.black.edgesIgnoringSafeArea(.all)) 44 | .edgesIgnoringSafeArea(.all) 45 | 46 | } 47 | } 48 | 49 | struct ContentView_Previews: PreviewProvider { 50 | static var previews: some View { 51 | ContentView() 52 | } 53 | } 54 | 55 | struct TabBar: View { 56 | @State var index: Int = 0; 57 | var body: some View{ 58 | HStack(spacing:0){ 59 | 60 | Button(action:{ 61 | self.index = 0 62 | }) { 63 | Image("home") 64 | .resizable() 65 | .frame(width: 25, height: 25) 66 | .foregroundColor(self.index == 0 ? .white : Color.white.opacity(0.3)) 67 | .padding(.horizontal) 68 | } 69 | 70 | Spacer(minLength: 0) 71 | 72 | Button(action:{ 73 | self.index = 1 74 | }) { 75 | Image("search") 76 | .resizable() 77 | .frame(width: 25, height: 25) 78 | .foregroundColor(self.index == 1 ? .white : Color.white.opacity(0.3)) 79 | .padding(.horizontal) 80 | } 81 | 82 | Spacer(minLength: 0) 83 | 84 | Button(action:{ 85 | self.index = 2 86 | }) { 87 | Image("upload") 88 | .renderingMode(.original) 89 | .resizable() 90 | .frame(width: 50, height: 35) 91 | .padding(.horizontal) 92 | } 93 | 94 | Spacer(minLength: 0) 95 | 96 | Button(action:{ 97 | self.index = 3 98 | }) { 99 | Image("comment") 100 | .resizable() 101 | .frame(width: 25, height: 25) 102 | .foregroundColor(self.index == 3 ? .white : Color.white.opacity(0.3)) 103 | .padding(.horizontal) 104 | } 105 | 106 | Spacer(minLength: 0) 107 | 108 | Button(action:{ 109 | self.index = 4 110 | }) { 111 | Image("profile") 112 | .resizable() 113 | .frame(width: 25, height: 25) 114 | .foregroundColor(self.index == 4 ? .white : Color.white.opacity(0.3)) 115 | .padding(.horizontal) 116 | } 117 | } 118 | .padding() 119 | } 120 | } 121 | 122 | struct RightTabBar: View { 123 | 124 | var body: some View{ 125 | 126 | HStack{ 127 | Spacer() 128 | 129 | VStack(spacing: 35){ 130 | 131 | Button(action:{ 132 | 133 | }) { 134 | Image("pic") 135 | .renderingMode(.original) 136 | .resizable() 137 | .frame(width: 50, height: 50) 138 | .clipShape(Circle()) 139 | } 140 | 141 | Button(action:{ 142 | 143 | }){ 144 | VStack(spacing: 8){ 145 | 146 | Image(systemName: "suit.heart.fill") 147 | .font(.title) 148 | .foregroundColor(.white) 149 | 150 | Text("22K") 151 | .foregroundColor(.white) 152 | } 153 | 154 | } 155 | 156 | Button(action:{ 157 | 158 | }){ 159 | VStack(spacing: 8){ 160 | 161 | Image(systemName: "message.fill") 162 | .font(.title) 163 | .foregroundColor(.white) 164 | 165 | Text("22K") 166 | .foregroundColor(.white) 167 | } 168 | 169 | } 170 | 171 | Button(action:{ 172 | 173 | }){ 174 | VStack(spacing: 8){ 175 | 176 | Image(systemName: "arrowshape.turn.up.right.fill") 177 | .font(.title) 178 | .foregroundColor(.white) 179 | 180 | Text("22K") 181 | .foregroundColor(.white) 182 | } 183 | 184 | } 185 | 186 | } 187 | .padding(.bottom, 55) 188 | .padding(.trailing) 189 | } 190 | } 191 | } 192 | 193 | struct TopTabBar: View { 194 | @State var top = 0 195 | 196 | var body: some View{ 197 | 198 | HStack(spacing: 15){ 199 | 200 | Button(action: { 201 | self.top = 0 202 | }){ 203 | Text("Following") 204 | .foregroundColor(self.top == 0 ? .white : Color.white.opacity(0.3)) 205 | .fontWeight(self.top == 0 ? .bold : .none) 206 | .padding(.vertical) 207 | } 208 | 209 | Button(action: { 210 | self.top = 1 211 | }){ 212 | Text("For You") 213 | .foregroundColor(self.top == 1 ? .white : Color.white.opacity(0.3)) 214 | .fontWeight(self.top == 1 ? .bold : .none) 215 | .padding(.vertical) 216 | } 217 | 218 | 219 | } 220 | } 221 | } 222 | 223 | 224 | 225 | 226 | 227 | class Host: UIHostingController{ 228 | 229 | override var preferredStatusBarStyle: UIStatusBarStyle{ 230 | return .lightContent 231 | } 232 | } 233 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Views/Player.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Player.swift 3 | // TiktokSwiftUI 4 | // 5 | // Created by Giresh Dora on 14/06/20. 6 | // Copyright © 2020 Giresh. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import SwiftUI 11 | import AVKit 12 | 13 | struct Player: UIViewControllerRepresentable { 14 | 15 | var player: AVPlayer 16 | 17 | func makeUIViewController(context: Context) -> AVPlayerViewController { 18 | let view = AVPlayerViewController() 19 | view.player = self.player 20 | view.showsPlaybackControls = false 21 | view.videoGravity = .resizeAspectFill 22 | return view 23 | } 24 | 25 | func updateUIViewController(_ uiViewController: AVPlayerViewController, context: Context) { 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /TiktokSwiftUI/TiktokSwiftUI/Views/PlayerScrollView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PlayerScrollView.swift 3 | // TiktokSwiftUI 4 | // 5 | // Created by Giresh Dora on 14/06/20. 6 | // Copyright © 2020 Giresh. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import SwiftUI 11 | 12 | struct PlayerScrollView: UIViewRepresentable { 13 | func makeCoordinator() -> PlayerScrollView.Coordinator { 14 | return PlayerScrollView.Coordinator(parent: self) 15 | } 16 | 17 | @Binding var data : [Video] 18 | 19 | func makeUIView(context: Context) -> UIScrollView { 20 | 21 | let view = UIScrollView() 22 | 23 | let childView = UIHostingController(rootView: PlayerView(data: self.$data)) 24 | childView.view.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height * CGFloat(data.count)) 25 | 26 | view.contentSize = CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height * CGFloat(data.count)) 27 | view.addSubview(childView.view) 28 | view.showsVerticalScrollIndicator = false 29 | view.showsHorizontalScrollIndicator = false 30 | 31 | view.contentInsetAdjustmentBehavior = .never 32 | view.isPagingEnabled = true 33 | view.delegate = context.coordinator 34 | 35 | return view 36 | } 37 | 38 | func updateUIView(_ uiView: UIScrollView, context: Context) { 39 | 40 | uiView.contentSize = CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height * CGFloat(data.count)) 41 | 42 | for i in 0..