├── README.md ├── SwiftUIDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── lee.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist └── SwiftUIDemo ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ ├── Contents.json │ ├── Icon.png │ ├── icon_20pt.png │ ├── icon_20pt@2x.png │ ├── icon_20pt@3x.png │ ├── icon_29pt.png │ ├── icon_29pt@2x.png │ ├── icon_29pt@3x.png │ ├── icon_40pt-1.png │ ├── icon_40pt.png │ ├── icon_40pt@2x.png │ ├── icon_40pt@3x.png │ ├── icon_60pt@2x.png │ ├── icon_60pt@3x.png │ ├── icon_76pt.png │ ├── icon_76pt@2x.png │ └── icon_83.5@2x.png ├── Background.imageset │ ├── Background.pdf │ └── Contents.json ├── Certificate1.imageset │ ├── Certificate1.pdf │ └── Contents.json ├── Certificate2.imageset │ ├── Certificate2.pdf │ └── Contents.json ├── Certificate3.imageset │ ├── Certificate3.pdf │ └── Contents.json ├── Certificate4.imageset │ ├── Certificate4.pdf │ └── Contents.json ├── Colors │ ├── Contents.json │ ├── accent.colorset │ │ └── Contents.json │ ├── accentShadow.colorset │ │ └── Contents.json │ ├── background.colorset │ │ └── Contents.json │ ├── background10.colorset │ │ └── Contents.json │ ├── background2.colorset │ │ └── Contents.json │ ├── background3.colorset │ │ └── Contents.json │ ├── background4.colorset │ │ └── Contents.json │ ├── background5.colorset │ │ └── Contents.json │ ├── background6.colorset │ │ └── Contents.json │ ├── background7.colorset │ │ └── Contents.json │ ├── background8.colorset │ │ └── Contents.json │ ├── background9.colorset │ │ └── Contents.json │ ├── button.colorset │ │ └── Contents.json │ ├── buttonShadow.colorset │ │ └── Contents.json │ ├── gradient1.colorset │ │ └── Contents.json │ ├── gradient2.colorset │ │ └── Contents.json │ ├── icons.colorset │ │ └── Contents.json │ ├── primary.colorset │ │ └── Contents.json │ ├── secondary.colorset │ │ └── Contents.json │ ├── shadow3.colorset │ │ └── Contents.json │ └── shadow4.colorset │ │ └── Contents.json ├── Contents.json ├── IconCards.imageset │ ├── Contents.json │ └── IconCards.pdf ├── IconHome.imageset │ ├── Contents.json │ └── IconHome.pdf ├── IconSettings.imageset │ ├── Contents.json │ └── IconSettings.pdf ├── Illustration1.imageset │ ├── Contents.json │ └── Illustration1.pdf ├── Illustration2.imageset │ ├── Contents.json │ └── Illustration2.pdf ├── Illustration3.imageset │ ├── Contents.json │ └── Illustration3.pdf ├── Illustration4.imageset │ ├── Contents.json │ └── Illustration4.pdf ├── Illustration5.imageset │ ├── Contents.json │ └── Illustration5.pdf └── Logo.imageset │ ├── Contents.json │ └── Logo.pdf ├── Base.lproj └── LaunchScreen.storyboard ├── BlurView.swift ├── CertificateRows.swift ├── ContentView.swift ├── Home.swift ├── HomeList.swift ├── Info.plist ├── Preview Content └── Preview Assets.xcassets │ └── Contents.json ├── SceneDelegate.swift ├── Settings.swift ├── TabBar.swift ├── UpdateDetail.swift ├── UpdateList.swift └── UpdateStore.swift /README.md: -------------------------------------------------------------------------------- 1 | # SwiftUIDemo 2 | 用SwiftUI构建完整应用-DesignCode 3 | -------------------------------------------------------------------------------- /SwiftUIDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9B042478233A202F002BE88D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B042477233A202F002BE88D /* AppDelegate.swift */; }; 11 | 9B04247A233A202F002BE88D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B042479233A202F002BE88D /* SceneDelegate.swift */; }; 12 | 9B04247C233A202F002BE88D /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B04247B233A202F002BE88D /* ContentView.swift */; }; 13 | 9B04247E233A2033002BE88D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9B04247D233A2033002BE88D /* Assets.xcassets */; }; 14 | 9B042481233A2033002BE88D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9B042480233A2033002BE88D /* Preview Assets.xcassets */; }; 15 | 9B042484233A2033002BE88D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9B042482233A2033002BE88D /* LaunchScreen.storyboard */; }; 16 | 9B0F1A2C233B73E400E42D89 /* Home.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B0F1A2B233B73E400E42D89 /* Home.swift */; }; 17 | 9B43BACF233C6ADC00F2E1B4 /* HomeList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B43BACE233C6ADC00F2E1B4 /* HomeList.swift */; }; 18 | 9BB1612C235ADA5100A8E227 /* UpdateStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BB1612B235ADA5100A8E227 /* UpdateStore.swift */; }; 19 | 9BB1612E235AEA5400A8E227 /* TabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BB1612D235AEA5400A8E227 /* TabBar.swift */; }; 20 | 9BB16130235B3ECC00A8E227 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BB1612F235B3ECC00A8E227 /* Settings.swift */; }; 21 | 9BB16132235B4B4B00A8E227 /* CertificateRows.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BB16131235B4B4B00A8E227 /* CertificateRows.swift */; }; 22 | 9BE8087F233E2C2B00A8F4F2 /* BlurView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE8087E233E2C2B00A8F4F2 /* BlurView.swift */; }; 23 | 9BFF8DFF234E299E006810DE /* UpdateList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BFF8DFE234E299E006810DE /* UpdateList.swift */; }; 24 | 9BFF8E01234E3286006810DE /* UpdateDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BFF8E00234E3286006810DE /* UpdateDetail.swift */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | 9B042474233A202F002BE88D /* SwiftUIDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftUIDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 9B042477233A202F002BE88D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 30 | 9B042479233A202F002BE88D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 31 | 9B04247B233A202F002BE88D /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 32 | 9B04247D233A2033002BE88D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 33 | 9B042480233A2033002BE88D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 34 | 9B042483233A2033002BE88D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 35 | 9B042485233A2033002BE88D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 9B0F1A2B233B73E400E42D89 /* Home.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Home.swift; sourceTree = ""; }; 37 | 9B43BACE233C6ADC00F2E1B4 /* HomeList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeList.swift; sourceTree = ""; }; 38 | 9BB1612B235ADA5100A8E227 /* UpdateStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateStore.swift; sourceTree = ""; }; 39 | 9BB1612D235AEA5400A8E227 /* TabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBar.swift; sourceTree = ""; }; 40 | 9BB1612F235B3ECC00A8E227 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; 41 | 9BB16131235B4B4B00A8E227 /* CertificateRows.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CertificateRows.swift; sourceTree = ""; }; 42 | 9BE8087E233E2C2B00A8F4F2 /* BlurView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurView.swift; sourceTree = ""; }; 43 | 9BFF8DFE234E299E006810DE /* UpdateList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateList.swift; sourceTree = ""; }; 44 | 9BFF8E00234E3286006810DE /* UpdateDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateDetail.swift; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 9B042471233A202F002BE88D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9B04246B233A202F002BE88D = { 59 | isa = PBXGroup; 60 | children = ( 61 | 9B042476233A202F002BE88D /* SwiftUIDemo */, 62 | 9B042475233A202F002BE88D /* Products */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | 9B042475233A202F002BE88D /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 9B042474233A202F002BE88D /* SwiftUIDemo.app */, 70 | ); 71 | name = Products; 72 | sourceTree = ""; 73 | }; 74 | 9B042476233A202F002BE88D /* SwiftUIDemo */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 9B042477233A202F002BE88D /* AppDelegate.swift */, 78 | 9B042479233A202F002BE88D /* SceneDelegate.swift */, 79 | 9BB1612D235AEA5400A8E227 /* TabBar.swift */, 80 | 9B04247B233A202F002BE88D /* ContentView.swift */, 81 | 9B0F1A2B233B73E400E42D89 /* Home.swift */, 82 | 9B43BACE233C6ADC00F2E1B4 /* HomeList.swift */, 83 | 9BFF8DFE234E299E006810DE /* UpdateList.swift */, 84 | 9BFF8E00234E3286006810DE /* UpdateDetail.swift */, 85 | 9BB1612B235ADA5100A8E227 /* UpdateStore.swift */, 86 | 9BB1612F235B3ECC00A8E227 /* Settings.swift */, 87 | 9BB16131235B4B4B00A8E227 /* CertificateRows.swift */, 88 | 9BE8087E233E2C2B00A8F4F2 /* BlurView.swift */, 89 | 9B04247D233A2033002BE88D /* Assets.xcassets */, 90 | 9B042482233A2033002BE88D /* LaunchScreen.storyboard */, 91 | 9B042485233A2033002BE88D /* Info.plist */, 92 | 9B04247F233A2033002BE88D /* Preview Content */, 93 | ); 94 | path = SwiftUIDemo; 95 | sourceTree = ""; 96 | }; 97 | 9B04247F233A2033002BE88D /* Preview Content */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 9B042480233A2033002BE88D /* Preview Assets.xcassets */, 101 | ); 102 | path = "Preview Content"; 103 | sourceTree = ""; 104 | }; 105 | /* End PBXGroup section */ 106 | 107 | /* Begin PBXNativeTarget section */ 108 | 9B042473233A202F002BE88D /* SwiftUIDemo */ = { 109 | isa = PBXNativeTarget; 110 | buildConfigurationList = 9B042488233A2033002BE88D /* Build configuration list for PBXNativeTarget "SwiftUIDemo" */; 111 | buildPhases = ( 112 | 9B042470233A202F002BE88D /* Sources */, 113 | 9B042471233A202F002BE88D /* Frameworks */, 114 | 9B042472233A202F002BE88D /* Resources */, 115 | ); 116 | buildRules = ( 117 | ); 118 | dependencies = ( 119 | ); 120 | name = SwiftUIDemo; 121 | productName = SwiftUIDemo; 122 | productReference = 9B042474233A202F002BE88D /* SwiftUIDemo.app */; 123 | productType = "com.apple.product-type.application"; 124 | }; 125 | /* End PBXNativeTarget section */ 126 | 127 | /* Begin PBXProject section */ 128 | 9B04246C233A202F002BE88D /* Project object */ = { 129 | isa = PBXProject; 130 | attributes = { 131 | LastSwiftUpdateCheck = 1100; 132 | LastUpgradeCheck = 1100; 133 | ORGANIZATIONNAME = Lee; 134 | TargetAttributes = { 135 | 9B042473233A202F002BE88D = { 136 | CreatedOnToolsVersion = 11.0; 137 | }; 138 | }; 139 | }; 140 | buildConfigurationList = 9B04246F233A202F002BE88D /* Build configuration list for PBXProject "SwiftUIDemo" */; 141 | compatibilityVersion = "Xcode 9.3"; 142 | developmentRegion = en; 143 | hasScannedForEncodings = 0; 144 | knownRegions = ( 145 | en, 146 | Base, 147 | ); 148 | mainGroup = 9B04246B233A202F002BE88D; 149 | productRefGroup = 9B042475233A202F002BE88D /* Products */; 150 | projectDirPath = ""; 151 | projectRoot = ""; 152 | targets = ( 153 | 9B042473233A202F002BE88D /* SwiftUIDemo */, 154 | ); 155 | }; 156 | /* End PBXProject section */ 157 | 158 | /* Begin PBXResourcesBuildPhase section */ 159 | 9B042472233A202F002BE88D /* Resources */ = { 160 | isa = PBXResourcesBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | 9B042484233A2033002BE88D /* LaunchScreen.storyboard in Resources */, 164 | 9B042481233A2033002BE88D /* Preview Assets.xcassets in Resources */, 165 | 9B04247E233A2033002BE88D /* Assets.xcassets in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXSourcesBuildPhase section */ 172 | 9B042470233A202F002BE88D /* Sources */ = { 173 | isa = PBXSourcesBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | 9B042478233A202F002BE88D /* AppDelegate.swift in Sources */, 177 | 9BB1612C235ADA5100A8E227 /* UpdateStore.swift in Sources */, 178 | 9BB16132235B4B4B00A8E227 /* CertificateRows.swift in Sources */, 179 | 9BFF8DFF234E299E006810DE /* UpdateList.swift in Sources */, 180 | 9B43BACF233C6ADC00F2E1B4 /* HomeList.swift in Sources */, 181 | 9BFF8E01234E3286006810DE /* UpdateDetail.swift in Sources */, 182 | 9B04247A233A202F002BE88D /* SceneDelegate.swift in Sources */, 183 | 9B0F1A2C233B73E400E42D89 /* Home.swift in Sources */, 184 | 9B04247C233A202F002BE88D /* ContentView.swift in Sources */, 185 | 9BE8087F233E2C2B00A8F4F2 /* BlurView.swift in Sources */, 186 | 9BB16130235B3ECC00A8E227 /* Settings.swift in Sources */, 187 | 9BB1612E235AEA5400A8E227 /* TabBar.swift in Sources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXSourcesBuildPhase section */ 192 | 193 | /* Begin PBXVariantGroup section */ 194 | 9B042482233A2033002BE88D /* LaunchScreen.storyboard */ = { 195 | isa = PBXVariantGroup; 196 | children = ( 197 | 9B042483233A2033002BE88D /* Base */, 198 | ); 199 | name = LaunchScreen.storyboard; 200 | sourceTree = ""; 201 | }; 202 | /* End PBXVariantGroup section */ 203 | 204 | /* Begin XCBuildConfiguration section */ 205 | 9B042486233A2033002BE88D /* Debug */ = { 206 | isa = XCBuildConfiguration; 207 | buildSettings = { 208 | ALWAYS_SEARCH_USER_PATHS = NO; 209 | CLANG_ANALYZER_NONNULL = YES; 210 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 211 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 212 | CLANG_CXX_LIBRARY = "libc++"; 213 | CLANG_ENABLE_MODULES = YES; 214 | CLANG_ENABLE_OBJC_ARC = YES; 215 | CLANG_ENABLE_OBJC_WEAK = YES; 216 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 217 | CLANG_WARN_BOOL_CONVERSION = YES; 218 | CLANG_WARN_COMMA = YES; 219 | CLANG_WARN_CONSTANT_CONVERSION = YES; 220 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 221 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 222 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 223 | CLANG_WARN_EMPTY_BODY = YES; 224 | CLANG_WARN_ENUM_CONVERSION = YES; 225 | CLANG_WARN_INFINITE_RECURSION = YES; 226 | CLANG_WARN_INT_CONVERSION = YES; 227 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 228 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 229 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 230 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 231 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 232 | CLANG_WARN_STRICT_PROTOTYPES = YES; 233 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 234 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 235 | CLANG_WARN_UNREACHABLE_CODE = YES; 236 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 237 | COPY_PHASE_STRIP = NO; 238 | DEBUG_INFORMATION_FORMAT = dwarf; 239 | ENABLE_STRICT_OBJC_MSGSEND = YES; 240 | ENABLE_TESTABILITY = YES; 241 | GCC_C_LANGUAGE_STANDARD = gnu11; 242 | GCC_DYNAMIC_NO_PIC = NO; 243 | GCC_NO_COMMON_BLOCKS = YES; 244 | GCC_OPTIMIZATION_LEVEL = 0; 245 | GCC_PREPROCESSOR_DEFINITIONS = ( 246 | "DEBUG=1", 247 | "$(inherited)", 248 | ); 249 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 250 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 251 | GCC_WARN_UNDECLARED_SELECTOR = YES; 252 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 253 | GCC_WARN_UNUSED_FUNCTION = YES; 254 | GCC_WARN_UNUSED_VARIABLE = YES; 255 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 256 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 257 | MTL_FAST_MATH = YES; 258 | ONLY_ACTIVE_ARCH = YES; 259 | SDKROOT = iphoneos; 260 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 261 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 262 | }; 263 | name = Debug; 264 | }; 265 | 9B042487233A2033002BE88D /* Release */ = { 266 | isa = XCBuildConfiguration; 267 | buildSettings = { 268 | ALWAYS_SEARCH_USER_PATHS = NO; 269 | CLANG_ANALYZER_NONNULL = YES; 270 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 271 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 272 | CLANG_CXX_LIBRARY = "libc++"; 273 | CLANG_ENABLE_MODULES = YES; 274 | CLANG_ENABLE_OBJC_ARC = YES; 275 | CLANG_ENABLE_OBJC_WEAK = YES; 276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_COMMA = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 282 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 283 | CLANG_WARN_EMPTY_BODY = YES; 284 | CLANG_WARN_ENUM_CONVERSION = YES; 285 | CLANG_WARN_INFINITE_RECURSION = YES; 286 | CLANG_WARN_INT_CONVERSION = YES; 287 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 288 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 289 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 290 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 291 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 292 | CLANG_WARN_STRICT_PROTOTYPES = YES; 293 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 294 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 295 | CLANG_WARN_UNREACHABLE_CODE = YES; 296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 297 | COPY_PHASE_STRIP = NO; 298 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 299 | ENABLE_NS_ASSERTIONS = NO; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | GCC_C_LANGUAGE_STANDARD = gnu11; 302 | GCC_NO_COMMON_BLOCKS = YES; 303 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 304 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 305 | GCC_WARN_UNDECLARED_SELECTOR = YES; 306 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 307 | GCC_WARN_UNUSED_FUNCTION = YES; 308 | GCC_WARN_UNUSED_VARIABLE = YES; 309 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 310 | MTL_ENABLE_DEBUG_INFO = NO; 311 | MTL_FAST_MATH = YES; 312 | SDKROOT = iphoneos; 313 | SWIFT_COMPILATION_MODE = wholemodule; 314 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 315 | VALIDATE_PRODUCT = YES; 316 | }; 317 | name = Release; 318 | }; 319 | 9B042489233A2033002BE88D /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 323 | CODE_SIGN_STYLE = Automatic; 324 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUIDemo/Preview Content\""; 325 | DEVELOPMENT_TEAM = GGP5472W8N; 326 | ENABLE_PREVIEWS = YES; 327 | INFOPLIST_FILE = SwiftUIDemo/Info.plist; 328 | LD_RUNPATH_SEARCH_PATHS = ( 329 | "$(inherited)", 330 | "@executable_path/Frameworks", 331 | ); 332 | PRODUCT_BUNDLE_IDENTIFIER = com.lee.SwiftUIDemo; 333 | PRODUCT_NAME = "$(TARGET_NAME)"; 334 | SWIFT_VERSION = 5.0; 335 | TARGETED_DEVICE_FAMILY = "1,2"; 336 | }; 337 | name = Debug; 338 | }; 339 | 9B04248A233A2033002BE88D /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 343 | CODE_SIGN_STYLE = Automatic; 344 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUIDemo/Preview Content\""; 345 | DEVELOPMENT_TEAM = GGP5472W8N; 346 | ENABLE_PREVIEWS = YES; 347 | INFOPLIST_FILE = SwiftUIDemo/Info.plist; 348 | LD_RUNPATH_SEARCH_PATHS = ( 349 | "$(inherited)", 350 | "@executable_path/Frameworks", 351 | ); 352 | PRODUCT_BUNDLE_IDENTIFIER = com.lee.SwiftUIDemo; 353 | PRODUCT_NAME = "$(TARGET_NAME)"; 354 | SWIFT_VERSION = 5.0; 355 | TARGETED_DEVICE_FAMILY = "1,2"; 356 | }; 357 | name = Release; 358 | }; 359 | /* End XCBuildConfiguration section */ 360 | 361 | /* Begin XCConfigurationList section */ 362 | 9B04246F233A202F002BE88D /* Build configuration list for PBXProject "SwiftUIDemo" */ = { 363 | isa = XCConfigurationList; 364 | buildConfigurations = ( 365 | 9B042486233A2033002BE88D /* Debug */, 366 | 9B042487233A2033002BE88D /* Release */, 367 | ); 368 | defaultConfigurationIsVisible = 0; 369 | defaultConfigurationName = Release; 370 | }; 371 | 9B042488233A2033002BE88D /* Build configuration list for PBXNativeTarget "SwiftUIDemo" */ = { 372 | isa = XCConfigurationList; 373 | buildConfigurations = ( 374 | 9B042489233A2033002BE88D /* Debug */, 375 | 9B04248A233A2033002BE88D /* Release */, 376 | ); 377 | defaultConfigurationIsVisible = 0; 378 | defaultConfigurationName = Release; 379 | }; 380 | /* End XCConfigurationList section */ 381 | }; 382 | rootObject = 9B04246C233A202F002BE88D /* Project object */; 383 | } 384 | -------------------------------------------------------------------------------- /SwiftUIDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftUIDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftUIDemo.xcodeproj/xcuserdata/lee.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SwiftUIDemo.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SwiftUIDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by Lee on 2019/9/24. 6 | // Copyright © 2019 Lee. 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 | -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "icon_20pt@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "icon_20pt@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "icon_29pt.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "icon_29pt@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "icon_29pt@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "icon_40pt@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "icon_40pt@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "icon_60pt@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "icon_60pt@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "icon_20pt.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "icon_40pt-1.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "idiom" : "ipad", 71 | "size" : "29x29", 72 | "scale" : "1x" 73 | }, 74 | { 75 | "idiom" : "ipad", 76 | "size" : "29x29", 77 | "scale" : "2x" 78 | }, 79 | { 80 | "size" : "40x40", 81 | "idiom" : "ipad", 82 | "filename" : "icon_40pt.png", 83 | "scale" : "1x" 84 | }, 85 | { 86 | "idiom" : "ipad", 87 | "size" : "40x40", 88 | "scale" : "2x" 89 | }, 90 | { 91 | "size" : "76x76", 92 | "idiom" : "ipad", 93 | "filename" : "icon_76pt.png", 94 | "scale" : "1x" 95 | }, 96 | { 97 | "size" : "76x76", 98 | "idiom" : "ipad", 99 | "filename" : "icon_76pt@2x.png", 100 | "scale" : "2x" 101 | }, 102 | { 103 | "size" : "83.5x83.5", 104 | "idiom" : "ipad", 105 | "filename" : "icon_83.5@2x.png", 106 | "scale" : "2x" 107 | }, 108 | { 109 | "size" : "1024x1024", 110 | "idiom" : "ios-marketing", 111 | "filename" : "Icon.png", 112 | "scale" : "1x" 113 | } 114 | ], 115 | "info" : { 116 | "version" : 1, 117 | "author" : "xcode" 118 | } 119 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/Icon.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_20pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_20pt.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_29pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_29pt.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_40pt-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_40pt-1.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_40pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_40pt.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_76pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_76pt.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Background.imageset/Background.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Background.imageset/Background.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Background.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Certificate1.imageset/Certificate1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Certificate1.imageset/Certificate1.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Certificate1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Certificate1.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Certificate2.imageset/Certificate2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Certificate2.imageset/Certificate2.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Certificate2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Certificate2.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Certificate3.imageset/Certificate3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Certificate3.imageset/Certificate3.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Certificate3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Certificate3.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Certificate4.imageset/Certificate4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Certificate4.imageset/Certificate4.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Certificate4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Certificate4.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/accent.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "display-p3", 11 | "components" : { 12 | "red" : "0x5E", 13 | "alpha" : "1.000", 14 | "blue" : "0xFA", 15 | "green" : "0xCD" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/accentShadow.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "display-p3", 11 | "components" : { 12 | "red" : "0x5E", 13 | "alpha" : "0.300", 14 | "blue" : "0xFA", 15 | "green" : "0xCD" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/background.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0xE6", 13 | "alpha" : "1.000", 14 | "blue" : "0xF3", 15 | "green" : "0xEA" 16 | } 17 | } 18 | }, 19 | { 20 | "idiom" : "universal", 21 | "appearances" : [ 22 | { 23 | "appearance" : "luminosity", 24 | "value" : "light" 25 | } 26 | ], 27 | "color" : { 28 | "color-space" : "srgb", 29 | "components" : { 30 | "red" : "0.902", 31 | "alpha" : "1.000", 32 | "blue" : "0.953", 33 | "green" : "0.918" 34 | } 35 | } 36 | }, 37 | { 38 | "idiom" : "universal", 39 | "appearances" : [ 40 | { 41 | "appearance" : "luminosity", 42 | "value" : "dark" 43 | } 44 | ], 45 | "color" : { 46 | "color-space" : "srgb", 47 | "components" : { 48 | "red" : "0x00", 49 | "alpha" : "1.000", 50 | "blue" : "0x00", 51 | "green" : "0x00" 52 | } 53 | } 54 | } 55 | ] 56 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/background10.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0xC9", 13 | "alpha" : "1.000", 14 | "blue" : "0x7A", 15 | "green" : "0x3C" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/background2.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0x00", 13 | "alpha" : "1.000", 14 | "blue" : "0x00", 15 | "green" : "0x00" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/background3.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0x45", 13 | "alpha" : "1.000", 14 | "blue" : "0xC9", 15 | "green" : "0x3C" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/background4.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0xEC", 13 | "alpha" : "1.000", 14 | "blue" : "0x7B", 15 | "green" : "0x7E" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/background5.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0.263", 13 | "alpha" : "1.000", 14 | "blue" : "0.808", 15 | "green" : "0.765" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/background6.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0x3F", 13 | "alpha" : "1.000", 14 | "blue" : "0xFF", 15 | "green" : "0xA2" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/background7.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0x3F", 13 | "alpha" : "1.000", 14 | "blue" : "0xFF", 15 | "green" : "0x54" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/background8.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0x45", 13 | "alpha" : "1.000", 14 | "blue" : "0xC9", 15 | "green" : "0x3C" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/background9.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0x80", 13 | "alpha" : "1.000", 14 | "blue" : "0xC9", 15 | "green" : "0x3C" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/button.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "1.000", 13 | "alpha" : "1.000", 14 | "blue" : "1.000", 15 | "green" : "1.000" 16 | } 17 | } 18 | }, 19 | { 20 | "idiom" : "universal", 21 | "appearances" : [ 22 | { 23 | "appearance" : "luminosity", 24 | "value" : "dark" 25 | } 26 | ], 27 | "color" : { 28 | "color-space" : "srgb", 29 | "components" : { 30 | "red" : "0x11", 31 | "alpha" : "1.000", 32 | "blue" : "0x11", 33 | "green" : "0x11" 34 | } 35 | } 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/buttonShadow.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0x00", 13 | "alpha" : "0.300", 14 | "blue" : "0x00", 15 | "green" : "0x00" 16 | } 17 | } 18 | }, 19 | { 20 | "idiom" : "universal", 21 | "appearances" : [ 22 | { 23 | "appearance" : "luminosity", 24 | "value" : "dark" 25 | } 26 | ], 27 | "color" : { 28 | "color-space" : "srgb", 29 | "components" : { 30 | "red" : "0.000", 31 | "alpha" : "0.300", 32 | "blue" : "0.000", 33 | "green" : "0.000" 34 | } 35 | } 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/gradient1.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "extended-srgb", 11 | "components" : { 12 | "red" : "0.271", 13 | "alpha" : "1.000", 14 | "blue" : "0.788", 15 | "green" : "0.235" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/gradient2.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "extended-srgb", 11 | "components" : { 12 | "red" : "0.447", 13 | "alpha" : "1.000", 14 | "blue" : "0.792", 15 | "green" : "0.424" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/icons.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0xA9", 13 | "alpha" : "1.000", 14 | "blue" : "0xD4", 15 | "green" : "0xBB" 16 | } 17 | } 18 | }, 19 | { 20 | "idiom" : "universal", 21 | "appearances" : [ 22 | { 23 | "appearance" : "luminosity", 24 | "value" : "dark" 25 | } 26 | ], 27 | "color" : { 28 | "color-space" : "srgb", 29 | "components" : { 30 | "red" : "0x66", 31 | "alpha" : "1.000", 32 | "blue" : "0x66", 33 | "green" : "0x66" 34 | } 35 | } 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/primary.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "1.000", 13 | "alpha" : "1.000", 14 | "blue" : "1.000", 15 | "green" : "1.000" 16 | } 17 | } 18 | }, 19 | { 20 | "idiom" : "universal", 21 | "appearances" : [ 22 | { 23 | "appearance" : "luminosity", 24 | "value" : "dark" 25 | } 26 | ], 27 | "color" : { 28 | "color-space" : "srgb", 29 | "components" : { 30 | "red" : "0xFF", 31 | "alpha" : "0.700", 32 | "blue" : "0xFF", 33 | "green" : "0xFF" 34 | } 35 | } 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/secondary.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "1.000", 13 | "alpha" : "0.600", 14 | "blue" : "1.000", 15 | "green" : "1.000" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/shadow3.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0.271", 13 | "alpha" : "0.300", 14 | "blue" : "0.788", 15 | "green" : "0.235" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Colors/shadow4.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0.925", 13 | "alpha" : "0.300", 14 | "blue" : "0.482", 15 | "green" : "0.494" 16 | } 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/IconCards.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "IconCards.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/IconCards.imageset/IconCards.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/IconCards.imageset/IconCards.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/IconHome.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "IconHome.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/IconHome.imageset/IconHome.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/IconHome.imageset/IconHome.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/IconSettings.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "IconSettings.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/IconSettings.imageset/IconSettings.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/IconSettings.imageset/IconSettings.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Illustration1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Illustration1.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Illustration1.imageset/Illustration1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Illustration1.imageset/Illustration1.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Illustration2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Illustration2.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Illustration2.imageset/Illustration2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Illustration2.imageset/Illustration2.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Illustration3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Illustration3.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Illustration3.imageset/Illustration3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Illustration3.imageset/Illustration3.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Illustration4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Illustration4.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Illustration4.imageset/Illustration4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Illustration4.imageset/Illustration4.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Illustration5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Illustration5.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Illustration5.imageset/Illustration5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Illustration5.imageset/Illustration5.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Logo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Logo.pdf", 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 | } -------------------------------------------------------------------------------- /SwiftUIDemo/Assets.xcassets/Logo.imageset/Logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiangboLee/SwiftUIDemo/114641b9a681261f2f9a688900994d65551a9db2/SwiftUIDemo/Assets.xcassets/Logo.imageset/Logo.pdf -------------------------------------------------------------------------------- /SwiftUIDemo/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 | -------------------------------------------------------------------------------- /SwiftUIDemo/BlurView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BlurView.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by Lee on 2019/9/27. 6 | // Copyright © 2019 Lee. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct BlurView: UIViewRepresentable { 12 | 13 | let style: UIBlurEffect.Style 14 | 15 | func makeUIView(context: UIViewRepresentableContext) -> UIView { 16 | let view = UIView(frame: .zero) 17 | view.backgroundColor = .clear 18 | let blurEffect = UIBlurEffect(style: style) 19 | let blurView = UIVisualEffectView(effect: blurEffect) 20 | blurView.translatesAutoresizingMaskIntoConstraints = false 21 | view.insertSubview(blurView, at: 0) 22 | NSLayoutConstraint.activate([ 23 | blurView.heightAnchor.constraint(equalTo: view.heightAnchor), 24 | blurView.widthAnchor.constraint(equalTo: view.widthAnchor) 25 | ]) 26 | return view 27 | } 28 | 29 | func updateUIView(_ uiView: UIView, context: UIViewRepresentableContext) { 30 | 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /SwiftUIDemo/CertificateRows.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CertificateRows.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by LEE on 2019/10/19. 6 | // Copyright © 2019 Lee. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct CertificateRows: View { 12 | 13 | let certificates = certificateData 14 | 15 | var body: some View { 16 | VStack(alignment: .leading) { 17 | Text("Certificates") 18 | .font(.system(size: 20)) 19 | .fontWeight(.heavy) 20 | .padding(.leading, 30) 21 | 22 | ScrollView(.horizontal, showsIndicators: false) { 23 | HStack(spacing: 20) { 24 | ForEach(certificates) { item in 25 | LeeView(item: item) 26 | } 27 | } 28 | .padding(20) 29 | .padding(.leading, 10) 30 | } 31 | } 32 | } 33 | } 34 | 35 | struct CertificateRows_Previews: PreviewProvider { 36 | static var previews: some View { 37 | CertificateRows() 38 | } 39 | } 40 | 41 | struct Certificate: Identifiable { 42 | var id = UUID() 43 | var title: String 44 | var image: String 45 | var width: CGFloat 46 | var height: CGFloat 47 | } 48 | 49 | let certificateData = [ 50 | Certificate(title: "OC", image: "Certificate1", width: 230, height: 150), 51 | Certificate(title: "Swift", image: "Certificate2", width: 230, height: 150), 52 | Certificate(title: "Java", image: "Certificate3", width: 230, height: 150), 53 | Certificate(title: "GO", image: "Certificate4", width: 230, height: 150), 54 | ] 55 | -------------------------------------------------------------------------------- /SwiftUIDemo/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by Lee on 2019/9/24. 6 | // Copyright © 2019 Lee. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ContentView: View { 12 | 13 | @State var show = false 14 | @State var viewState = CGSize.zero 15 | 16 | var body: some View { 17 | ZStack { 18 | 19 | BlurView(style: .systemMaterial) 20 | 21 | TitleView() 22 | .blur(radius: show ? 20 : 0) 23 | .animation(.default) 24 | 25 | CardBottomView() 26 | .blur(radius: show ? 20 : 0) 27 | .animation(.default) 28 | 29 | CardView() 30 | .background(show ? Color.red : Color("background8")) 31 | .cornerRadius(10.0) 32 | .shadow(radius: 20) 33 | .offset(x: 0, y: show ? -400 : -40.0) 34 | .scaleEffect(0.85) 35 | .rotationEffect(Angle(degrees: show ? 15.0 : 0)) 36 | .rotation3DEffect(Angle(degrees: show ? 50 : 0), axis: (x: 10.0, y: 10.0, z: 10.0)).animation(Animation.easeInOut(duration: 0.7)) 37 | .offset(x: viewState.width, y: viewState.height) 38 | 39 | CardView() 40 | .background(show ? Color.blue : Color("background9")) 41 | .cornerRadius(10.0) 42 | .shadow(radius: 20) 43 | .offset(x: 0, y: show ? -200 : -20.0) 44 | .scaleEffect(0.9) 45 | .rotationEffect(Angle(degrees: show ? 10.0 : 0)) 46 | .rotation3DEffect(Angle(degrees: show ? 40 : 0), axis: (x: 10.0, y: 10.0, z: 10.0)) 47 | .animation(Animation.easeInOut(duration: 0.5)) 48 | .offset(x: viewState.width, y: viewState.height) 49 | 50 | LeeView() 51 | .offset(x: viewState.width, y: viewState.height) 52 | .scaleEffect(0.95) 53 | .rotationEffect(Angle(degrees: show ? 5.0 : 0)) 54 | .rotation3DEffect(Angle(degrees: show ? 30 : 0), axis: (x: 10.0, y: 10.0, z: 10.0)) 55 | .animation(.spring()) 56 | .onTapGesture { 57 | self.show.toggle() 58 | } 59 | .gesture( 60 | DragGesture() 61 | .onChanged({ (value) in 62 | self.viewState = value.translation; 63 | self.show = true; 64 | }) 65 | .onEnded({ (value) in 66 | self.viewState = CGSize.zero; 67 | self.show = false; 68 | }) 69 | ) 70 | } 71 | } 72 | } 73 | 74 | struct ContentView_Previews: PreviewProvider { 75 | static var previews: some View { 76 | ContentView() 77 | } 78 | } 79 | 80 | struct CardView: View { 81 | var body: some View { 82 | VStack { 83 | Text("Card") 84 | } 85 | .frame(width: 340.0, height: 220.0) 86 | } 87 | } 88 | 89 | struct LeeView: View { 90 | 91 | var item = Certificate(title: "Hello World", image: "Background", width: 340.0, height: 220.0) 92 | 93 | var body: some View { 94 | VStack { 95 | HStack { 96 | VStack(alignment: .leading) { 97 | Text(item.title) 98 | .font(.headline) 99 | .fontWeight(.bold) 100 | .foregroundColor(Color("accent")) 101 | .padding(.top) 102 | Text("lee jiangbo") 103 | .foregroundColor(Color.white) 104 | } 105 | .padding(.leading) 106 | Spacer() 107 | Image("Logo") 108 | .resizable() 109 | .frame(width: 30.0, height: 30.0) 110 | 111 | } 112 | .padding(.horizontal) 113 | Spacer() 114 | Image(item.image) 115 | .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity) 116 | .offset(y: 80) 117 | } 118 | .frame(width: item.width, height: item.height) 119 | .background(Color.black) 120 | .cornerRadius(10.0) 121 | .shadow(radius: 10.0) 122 | } 123 | } 124 | 125 | struct TitleView: View { 126 | var body: some View { 127 | VStack { 128 | HStack { 129 | Text("Certificates") 130 | .font(.largeTitle) 131 | .fontWeight(.heavy) 132 | Spacer() 133 | } 134 | Image("Illustration5") 135 | Spacer() 136 | }.padding() 137 | } 138 | } 139 | 140 | struct CardBottomView: View { 141 | var body: some View { 142 | VStack(spacing: 20.0) { 143 | Rectangle() 144 | .frame(width: 60, height: 6) 145 | .cornerRadius(3.0) 146 | .opacity(0.1) 147 | Text("ad发货地of地方叫都叫欧迪芬恐怕发快递搜房卡是都开发的伤口欧派的疯狂的搜发快递佛龛的是佛防控") 148 | .font(.body) 149 | .lineLimit(5) 150 | Spacer() 151 | } 152 | .frame(minWidth:0, maxWidth: .infinity) 153 | .padding() 154 | .padding(.horizontal) 155 | .background(BlurView(style: .systemMaterial)) 156 | .cornerRadius(30) 157 | .shadow(radius: 20) 158 | .offset(y: UIScreen.main.bounds.height - 270) 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /SwiftUIDemo/Home.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Home.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by Lee on 2019/9/25. 6 | // Copyright © 2019 Lee. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | let statusBarHeight = UIApplication.shared.windows[0].windowScene?.statusBarManager?.statusBarFrame.height ?? 0 12 | let screen = UIScreen.main.bounds 13 | 14 | 15 | struct Home: View { 16 | 17 | @State var show: Bool = false 18 | @State var showProfile: Bool = false 19 | 20 | var body: some View { 21 | ZStack { 22 | 23 | HomeList() 24 | .blur(radius: show ? 20 : 0) 25 | .scaleEffect(showProfile ? 0.95 : 1) 26 | .animation(.default) 27 | 28 | ContentView() 29 | .frame(minWidth: 0, maxWidth: 712) 30 | .cornerRadius(30) 31 | .shadow(radius: 20) 32 | .animation(.spring()) 33 | .offset(y: showProfile ? 40 + statusBarHeight : screen.height) 34 | 35 | MenuButton(show: $show) 36 | .offset(x: -40, y: showProfile ? statusBarHeight : 80) 37 | .animation(.spring()) 38 | 39 | MenuRight(show: $showProfile) 40 | .offset(x: -16, y: showProfile ? statusBarHeight : 88) 41 | .animation(.spring()) 42 | 43 | MenuView(show: $show) 44 | } 45 | .background(Color("background")) 46 | .edgesIgnoringSafeArea(.all) 47 | } 48 | } 49 | 50 | struct Home_Previews: PreviewProvider { 51 | static var previews: some View { 52 | Home() 53 | // Group { 54 | // Home().previewDevice("iPhone SE") 55 | // Home().previewDevice("iPhone Xʀ") 56 | // Home().previewDevice("iPad Pro (9.7-inch)") 57 | // } 58 | } 59 | } 60 | 61 | struct MenuRow: View { 62 | var image = "person.crop.circle" 63 | var text = "Hello World!" 64 | var body: some View { 65 | HStack { 66 | Image(systemName: image) 67 | .imageScale(.large) 68 | .foregroundColor(.red) 69 | .frame(width: 32, height: 32) 70 | Text(text) 71 | .foregroundColor(.primary) 72 | .font(.headline) 73 | Spacer() 74 | } 75 | } 76 | } 77 | 78 | struct Menu: Identifiable { 79 | var id = UUID() 80 | var title : String 81 | var icon : String 82 | } 83 | 84 | let menuData = [ 85 | Menu(title: "Hello World!", icon: "person.crop.circle"), 86 | Menu(title: "setting", icon: "gear"), 87 | Menu(title: "lee", icon: "square.and.arrow.up"), 88 | Menu(title: "Hello jiang", icon: "trash"), 89 | Menu(title: "Hello bo", icon: "paperplane"), 90 | ] 91 | 92 | 93 | struct MenuView: View { 94 | 95 | @Binding var show : Bool 96 | @State var showUpdate = false 97 | let menu = menuData 98 | 99 | var body: some View { 100 | HStack { 101 | VStack(alignment: .leading, spacing: 20) { 102 | 103 | ForEach(menu) { item in 104 | if (item.title == "setting") { 105 | Button(action: { 106 | self.showUpdate.toggle() 107 | }) { 108 | MenuRow(image: item.icon, text: item.title) 109 | }.sheet(isPresented: self.$showUpdate) { 110 | Settings() 111 | } 112 | } else { 113 | MenuRow(image: item.icon, text: item.title) 114 | } 115 | } 116 | Spacer() 117 | } 118 | .padding(.top, 20) 119 | .padding(30) 120 | .background(Color("button")) 121 | .frame(minWidth: 0, maxWidth: 360) 122 | .cornerRadius(30.0) 123 | .padding(.trailing, 60) 124 | .shadow(radius: 20) 125 | .animation(.default) 126 | .rotation3DEffect(Angle(degrees: show ? 0 : 60), axis: (x: 0, y: 10.0, z: 0)) 127 | .offset(x: show ? 0 : -screen.width) 128 | .onTapGesture { 129 | self.show.toggle() 130 | } 131 | Spacer() 132 | } 133 | .padding(.top, statusBarHeight) 134 | } 135 | } 136 | 137 | struct CircleButton: View { 138 | var icon = "person.crop.circle" 139 | var body: some View { 140 | HStack { 141 | Image(systemName: icon) 142 | .foregroundColor(.primary) 143 | } 144 | .frame(width: 44, height: 44) 145 | .background(Color("button")) 146 | .cornerRadius(22) 147 | .shadow(color: Color("buttonShadow"), radius: 10, x: 0, y: 10) 148 | } 149 | } 150 | 151 | struct MenuButton: View { 152 | @Binding var show : Bool 153 | var body: some View { 154 | VStack() { 155 | HStack { 156 | Button(action: { 157 | self.show.toggle() 158 | }) { 159 | HStack { 160 | Spacer() 161 | Image(systemName: "list.dash") 162 | .foregroundColor(.primary) 163 | } 164 | .padding(.trailing, 18) 165 | .frame(width: 90, height: 60) 166 | .background(Color("button")) 167 | .cornerRadius(30) 168 | .shadow(color: Color("buttonShadow"), radius: 10, x: 0, y: 10) 169 | } 170 | Spacer() 171 | } 172 | Spacer() 173 | } 174 | } 175 | } 176 | 177 | struct MenuRight: View { 178 | @Binding var show : Bool 179 | @State var showUpdate = false 180 | var body: some View { 181 | VStack() { 182 | HStack { 183 | Spacer() 184 | Button(action: { 185 | self.show.toggle() 186 | }) { 187 | CircleButton(icon: "person.crop.circle") 188 | } 189 | 190 | Button(action: { 191 | self.showUpdate.toggle() 192 | }) { 193 | CircleButton(icon: "bell") 194 | }.sheet(isPresented: $showUpdate) { 195 | UpdateList() 196 | } 197 | } 198 | Spacer() 199 | } 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /SwiftUIDemo/HomeList.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HomeList.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by Lee on 2019/9/26. 6 | // Copyright © 2019 Lee. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct HomeList: View { 12 | 13 | let courseData = CourseData 14 | @State var showModel = false 15 | 16 | var body: some View { 17 | 18 | ScrollView { 19 | VStack { 20 | HStack { 21 | VStack { 22 | Text("Hello") 23 | .font(.largeTitle) 24 | .fontWeight(.heavy) 25 | Text("22 person") 26 | .foregroundColor(.gray) 27 | } 28 | Spacer() 29 | } 30 | .padding(.leading, 70) 31 | 32 | ScrollView(.horizontal, showsIndicators: false) { 33 | HStack(spacing: 30) { 34 | ForEach(courseData) { item in 35 | Button(action: { 36 | self.showModel = true 37 | }) { 38 | GeometryReader { geometry in 39 | CourseView( 40 | title: item.title, 41 | image: item.image, 42 | backgroundColor: item.backgroundColor, 43 | shadowColor: item.shadowColor 44 | ) 45 | .rotation3DEffect(Angle(degrees: Double(geometry.frame(in: .global).minX - 40) / -40), axis: (x: 0, y: 10, z: 0)) 46 | } 47 | .frame(width: 246, height: 360) 48 | }.sheet(isPresented: self.$showModel) { 49 | ContentView() 50 | } 51 | 52 | } 53 | } 54 | .padding(.leading, 30) 55 | .padding(.top, 30) 56 | .padding(.bottom, 70) 57 | Spacer() 58 | } 59 | 60 | CertificateRows() 61 | } 62 | .padding(.top, 78) 63 | .padding(.bottom, 83) 64 | } 65 | } 66 | } 67 | 68 | struct HomeList_Previews: PreviewProvider { 69 | static var previews: some View { 70 | HomeList() 71 | } 72 | } 73 | 74 | struct CourseView: View { 75 | var title : String = "Build an app with SwiftUI" 76 | var image : String = "Illustration1" 77 | var backgroundColor: Color = Color("background3") 78 | var shadowColor : Color = Color("shadow3") 79 | var body: some View { 80 | VStack(alignment: .leading) { 81 | Text(title) 82 | .font(.title) 83 | .fontWeight(.bold) 84 | .foregroundColor(.white) 85 | .padding(20) 86 | .lineLimit(4) 87 | .padding(.trailing, 50) 88 | Spacer() 89 | Image(image) 90 | .resizable() 91 | .renderingMode(.original) 92 | .aspectRatio(contentMode: ContentMode.fit) 93 | .frame(width: 246, height: 150) 94 | .padding(.bottom, 30) 95 | } 96 | .background(backgroundColor) 97 | .cornerRadius(30) 98 | .frame(width: 246, height: 360) 99 | .shadow(color: shadowColor, radius: 20, x: 0, y: 20) 100 | } 101 | } 102 | 103 | struct Course: Identifiable { 104 | var id = UUID() 105 | var title : String 106 | var image : String 107 | var backgroundColor: Color 108 | var shadowColor : Color 109 | } 110 | 111 | let CourseData = [ 112 | Course( 113 | title: "Build an app with SwiftUI", 114 | image: "Illustration1", 115 | backgroundColor: Color("background3"), 116 | shadowColor: Color("shadow3") 117 | ), 118 | Course( 119 | title: "Hello cat haha", 120 | image: "Illustration2", 121 | backgroundColor: Color("background4"), 122 | shadowColor: Color("shadow4") 123 | ), 124 | Course( 125 | title: "Build an app with SwiftUI", 126 | image: "Illustration1", 127 | backgroundColor: Color("background3"), 128 | shadowColor: Color("shadow3") 129 | ), 130 | Course( 131 | title: "Hello cat haha", 132 | image: "Illustration2", 133 | backgroundColor: Color("background4"), 134 | shadowColor: Color("shadow4") 135 | ), 136 | Course( 137 | title: "Build an app with SwiftUI", 138 | image: "Illustration1", 139 | backgroundColor: Color("background3"), 140 | shadowColor: Color("shadow3") 141 | ), 142 | Course( 143 | title: "Hello cat haha", 144 | image: "Illustration2", 145 | backgroundColor: Color("background4"), 146 | shadowColor: Color("shadow4") 147 | ) 148 | ] 149 | -------------------------------------------------------------------------------- /SwiftUIDemo/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 | -------------------------------------------------------------------------------- /SwiftUIDemo/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SwiftUIDemo/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by Lee on 2019/9/24. 6 | // Copyright © 2019 Lee. 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 = TabBar() 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 = UIHostingController(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 | -------------------------------------------------------------------------------- /SwiftUIDemo/Settings.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Settings.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by LEE on 2019/10/19. 6 | // Copyright © 2019 Lee. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct Settings: View { 12 | @State var toggleOn = true 13 | @State var number = 1 14 | @State var selection = 1 15 | @State var date = Date() 16 | @State var email = "" 17 | @State var submit = false 18 | var body: some View { 19 | NavigationView { 20 | Form { 21 | Toggle(isOn: $toggleOn) { 22 | Text("Hello") 23 | } 24 | Stepper(value: $number, in: 1...10) { 25 | Text("\(number) WORLD\(number > 1 ? "s" : "")") 26 | } 27 | Picker(selection: $selection, label: Text("Picker")) { 28 | Text("111").tag(1) 29 | Text("222").tag(2) 30 | } 31 | DatePicker(selection: $date, label: { Text("Date") }) 32 | Section(header: Text("Email")) { 33 | TextField("your email", text: $email) 34 | .textFieldStyle(RoundedBorderTextFieldStyle()) 35 | } 36 | Button(action: {self.submit.toggle()}) { 37 | Text("submit") 38 | } 39 | .alert(isPresented: $submit) { 40 | Alert(title: Text("Thanks"), message: Text("\(email)")) 41 | } 42 | 43 | } 44 | .navigationBarTitle("Settings") 45 | } 46 | } 47 | } 48 | 49 | struct Settings_Previews: PreviewProvider { 50 | static var previews: some View { 51 | Settings() 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /SwiftUIDemo/TabBar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TabBar.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by LEE on 2019/10/19. 6 | // Copyright © 2019 Lee. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct TabBar: View { 12 | @State var selectedView = 1 13 | 14 | init() { 15 | UITabBar.appearance().backgroundColor = UIColor.orange 16 | } 17 | 18 | var body: some View { 19 | TabView(selection: $selectedView) { 20 | Home() 21 | .tabItem { 22 | Image("IconHome") 23 | Text("Home") 24 | } 25 | .tag(1) 26 | ContentView() 27 | .tabItem { 28 | Image("IconCards") 29 | Text("Certificates") 30 | } 31 | .tag(2) 32 | Settings() 33 | .tabItem { 34 | Image("IconSettings") 35 | Text("Settings") 36 | } 37 | .tag(3) 38 | } 39 | .accentColor(.black) 40 | .edgesIgnoringSafeArea(.top) 41 | } 42 | } 43 | 44 | struct TabBar_Previews: PreviewProvider { 45 | static var previews: some View { 46 | TabBar() 47 | // .environment(\.colorScheme, .dark) 48 | // .environment(\.sizeCategory, .extraExtraLarge) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /SwiftUIDemo/UpdateDetail.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UpdateDetail.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by LEE on 2019/10/9. 6 | // Copyright © 2019 Lee. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct UpdateDetail: View { 12 | 13 | var title = "Swiftui" 14 | var text = "Loading" 15 | var image = "Illustration1" 16 | 17 | 18 | var body: some View { 19 | VStack(spacing: 20.0) { 20 | Text(title) 21 | .font(.largeTitle) 22 | .fontWeight(.heavy) 23 | 24 | Image(image) 25 | .resizable() 26 | .aspectRatio(contentMode: .fit) 27 | .frame(height: 200) 28 | 29 | Text(text) 30 | .frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) 31 | 32 | Spacer() 33 | } 34 | .padding(30.0) 35 | } 36 | } 37 | 38 | struct UpdateDetail_Previews: PreviewProvider { 39 | static var previews: some View { 40 | UpdateDetail() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /SwiftUIDemo/UpdateList.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UpdateList.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by LEE on 2019/10/9. 6 | // Copyright © 2019 Lee. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct UpdateList: View { 12 | 13 | var updates = updateDate 14 | @ObservedObject var store = UpdateStore(updates: updateDate) 15 | 16 | func addItem() { 17 | store.updates.append(Update(image: "Illustration1", title: "newTitle", text: "newText", date: "JUN 26")) 18 | } 19 | func move(from source: IndexSet, to destination: Int) { 20 | #warning("not use swap!!! crash!!!") 21 | store.updates.move(fromOffsets: source, toOffset: destination) 22 | } 23 | 24 | var body: some View { 25 | NavigationView { 26 | 27 | VStack { 28 | Button(action: addItem) { 29 | Text("Add Item") 30 | .foregroundColor(.white) 31 | } 32 | .padding(8) 33 | .background(Color("background3")) 34 | .cornerRadius(8) 35 | 36 | List { 37 | ForEach(store.updates) { item in 38 | NavigationLink(destination: UpdateDetail(title: item.title, text: item.text, image: item.image)) { 39 | HStack(spacing: 12.0) { 40 | Image(item.image) 41 | .resizable() 42 | .aspectRatio(contentMode: .fit) 43 | .frame(width: 80, height: 80) 44 | .background(Color("background")) 45 | .cornerRadius(20) 46 | 47 | VStack(alignment: .leading) { 48 | Text(item.title) 49 | .font(.headline) 50 | Text(item.text) 51 | .lineLimit(2) 52 | .lineSpacing(4) 53 | .font(.subheadline) 54 | Text(item.date) 55 | .font(.caption) 56 | .fontWeight(.bold) 57 | .foregroundColor(.gray) 58 | } 59 | } 60 | } 61 | .padding(.vertical, 8) 62 | } 63 | .onDelete { indexSet in 64 | self.store.updates.remove(at: indexSet.first!) 65 | } 66 | .onMove(perform: move) 67 | } 68 | .navigationBarTitle("Updates") 69 | .navigationBarItems(trailing: 70 | EditButton() 71 | ) 72 | } 73 | 74 | } 75 | } 76 | } 77 | 78 | struct UpdateList_Previews: PreviewProvider { 79 | static var previews: some View { 80 | UpdateList() 81 | } 82 | } 83 | 84 | struct Update: Identifiable { 85 | var id = UUID() 86 | var image: String 87 | var title: String 88 | var text: String 89 | var date: String 90 | } 91 | 92 | let updateDate = [ 93 | Update(image: "Illustration1", title: "swiftui", text: "大家忽视覅偶尔回复而韩国is的hi多少个is多个收到货IGis个his读后感is多个hi韩国ID深V出魔抗VBUI欧盟是的归属感就是 属地化工is多个hi是个 是个hi第三帝国会死哦低功耗is电话公司工会", date: "JUN 26"), 94 | Update(image: "Illustration2", title: "swiftui", text: "大家忽视覅偶尔回复而韩国is的hi多少个is多个收到货IGis个his读后感is多个hi韩国ID深V出魔抗VBUI欧盟是的归属感就是 属地化工is多个hi是个 是个hi第三帝国会死哦低功耗is电话公司工会", date: "JUN 26"), 95 | Update(image: "Illustration3", title: "swiftui", text: "大家忽视覅偶尔回复而韩国is的hi多少个is多个收到货IGis个his读后感is多个hi韩国ID深V出魔抗VBUI欧盟是的归属感就是 属地化工is多个hi是个 是个hi第三帝国会死哦低功耗is电话公司工会", date: "JUN 26"), 96 | Update(image: "Illustration4", title: "swiftui", text: "大家忽视覅偶尔回复而韩国is的hi多少个is多个收到货IGis个his读后感is多个hi韩国ID深V出魔抗VBUI欧盟是的归属感就是 属地化工is多个hi是个 是个hi第三帝国会死哦低功耗is电话公司工会", date: "JUN 26"), 97 | Update(image: "Certificate1", title: "swiftui", text: "大家忽视覅偶尔回复而韩国is的hi多少个is多个收到货IGis个his读后感is多个hi韩国ID深V出魔抗VBUI欧盟是的归属感就是 属地化工is多个hi是个 是个hi第三帝国会死哦低功耗is电话公司工会", date: "JUN 26"), 98 | Update(image: "Certificate2", title: "swiftui", text: "大家忽视覅偶尔回复而韩国is的hi多少个is多个收到货IGis个his读后感is多个hi韩国ID深V出魔抗VBUI欧盟是的归属感就是 属地化工is多个hi是个 是个hi第三帝国会死哦低功耗is电话公司工会", date: "JUN 26"), 99 | Update(image: "Certificate3", title: "swiftui", text: "大家忽视覅偶尔回复而韩国is的hi多少个is多个收到货IGis个his读后感is多个hi韩国ID深V出魔抗VBUI欧盟是的归属感就是 属地化工is多个hi是个 是个hi第三帝国会死哦低功耗is电话公司工会", date: "JUN 26"), 100 | ] 101 | -------------------------------------------------------------------------------- /SwiftUIDemo/UpdateStore.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UpdateStore.swift 3 | // SwiftUIDemo 4 | // 5 | // Created by LEE on 2019/10/19. 6 | // Copyright © 2019 Lee. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import Combine 11 | 12 | class UpdateStore: ObservableObject { 13 | let didChange = PassthroughSubject() 14 | 15 | @Published var updates: [Update] = [] 16 | 17 | init(updates: [Update] = []) { 18 | self.updates = updates 19 | } 20 | } 21 | --------------------------------------------------------------------------------