├── .gitignore ├── 0.png ├── MyApp.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── MyApp.xcscheme │ └── MyWidgetExtension.xcscheme ├── MyApp ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── ContentView.swift ├── MyAppApp.swift └── Preview Content │ └── Preview Assets.xcassets │ └── Contents.json ├── MyWidget ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ └── WidgetBackground.colorset │ │ └── Contents.json ├── FooObject.h ├── FooObject.mm ├── Info.plist ├── MyApp-Bridging-Header.h ├── MyWidget.swift └── MyWidgetBundle.swift └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/swiftpm,xcode 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=swiftpm,xcode 3 | 4 | ### SwiftPM ### 5 | Packages 6 | .build/ 7 | xcuserdata 8 | DerivedData/ 9 | 10 | 11 | ### Xcode ### 12 | ## User settings 13 | xcuserdata/ 14 | 15 | ## Xcode 8 and earlier 16 | *.xcscmblueprint 17 | *.xccheckout 18 | 19 | ### Xcode Patch ### 20 | *.xcodeproj/* 21 | !*.xcodeproj/project.pbxproj 22 | !*.xcodeproj/xcshareddata/ 23 | !*.xcodeproj/project.xcworkspace/ 24 | !*.xcworkspace/contents.xcworkspacedata 25 | /*.gcno 26 | **/xcshareddata/WorkspaceSettings.xcsettings 27 | 28 | # End of https://www.toptal.com/developers/gitignore/api/swiftpm,xcode 29 | 30 | -------------------------------------------------------------------------------- /0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pookjw/ClearAndBlurredWidgets/8f496738e89d779dba0bf832ba63bd6db55a97dd/0.png -------------------------------------------------------------------------------- /MyApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 77; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4FADB9992C9680000014E725 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FADB9982C967FFF0014E725 /* WidgetKit.framework */; }; 11 | 4FADB99B2C9680000014E725 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FADB99A2C9680000014E725 /* SwiftUI.framework */; }; 12 | 4FADB9A62C9680010014E725 /* MyWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 4FADB9962C967FFF0014E725 /* MyWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXContainerItemProxy section */ 16 | 4FADB9A42C9680010014E725 /* PBXContainerItemProxy */ = { 17 | isa = PBXContainerItemProxy; 18 | containerPortal = 4FADB9792C967FEE0014E725 /* Project object */; 19 | proxyType = 1; 20 | remoteGlobalIDString = 4FADB9952C967FFF0014E725; 21 | remoteInfo = MyWidgetExtension; 22 | }; 23 | /* End PBXContainerItemProxy section */ 24 | 25 | /* Begin PBXCopyFilesBuildPhase section */ 26 | 4FADB9AB2C9680010014E725 /* Embed Foundation Extensions */ = { 27 | isa = PBXCopyFilesBuildPhase; 28 | buildActionMask = 2147483647; 29 | dstPath = ""; 30 | dstSubfolderSpec = 13; 31 | files = ( 32 | 4FADB9A62C9680010014E725 /* MyWidgetExtension.appex in Embed Foundation Extensions */, 33 | ); 34 | name = "Embed Foundation Extensions"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 4FADB9812C967FEE0014E725 /* MyApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MyApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 4FADB9962C967FFF0014E725 /* MyWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = MyWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 4FADB9982C967FFF0014E725 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; 43 | 4FADB99A2C9680000014E725 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; 44 | /* End PBXFileReference section */ 45 | 46 | /* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ 47 | 4FADB9A72C9680010014E725 /* Exceptions for "MyWidget" folder in "MyWidgetExtension" target */ = { 48 | isa = PBXFileSystemSynchronizedBuildFileExceptionSet; 49 | additionalCompilerFlagsByRelativePath = { 50 | FooObject.mm = "-fno-objc-arc"; 51 | }; 52 | membershipExceptions = ( 53 | Info.plist, 54 | ); 55 | target = 4FADB9952C967FFF0014E725 /* MyWidgetExtension */; 56 | }; 57 | /* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ 58 | 59 | /* Begin PBXFileSystemSynchronizedRootGroup section */ 60 | 4FADB9832C967FEE0014E725 /* MyApp */ = { 61 | isa = PBXFileSystemSynchronizedRootGroup; 62 | path = MyApp; 63 | sourceTree = ""; 64 | }; 65 | 4FADB99C2C9680000014E725 /* MyWidget */ = { 66 | isa = PBXFileSystemSynchronizedRootGroup; 67 | exceptions = ( 68 | 4FADB9A72C9680010014E725 /* Exceptions for "MyWidget" folder in "MyWidgetExtension" target */, 69 | ); 70 | path = MyWidget; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXFileSystemSynchronizedRootGroup section */ 74 | 75 | /* Begin PBXFrameworksBuildPhase section */ 76 | 4FADB97E2C967FEE0014E725 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | 4FADB9932C967FFF0014E725 /* Frameworks */ = { 84 | isa = PBXFrameworksBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | 4FADB99B2C9680000014E725 /* SwiftUI.framework in Frameworks */, 88 | 4FADB9992C9680000014E725 /* WidgetKit.framework in Frameworks */, 89 | ); 90 | runOnlyForDeploymentPostprocessing = 0; 91 | }; 92 | /* End PBXFrameworksBuildPhase section */ 93 | 94 | /* Begin PBXGroup section */ 95 | 4FADB9782C967FEE0014E725 = { 96 | isa = PBXGroup; 97 | children = ( 98 | 4FADB9832C967FEE0014E725 /* MyApp */, 99 | 4FADB99C2C9680000014E725 /* MyWidget */, 100 | 4FADB9972C967FFF0014E725 /* Frameworks */, 101 | 4FADB9822C967FEE0014E725 /* Products */, 102 | ); 103 | sourceTree = ""; 104 | }; 105 | 4FADB9822C967FEE0014E725 /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 4FADB9812C967FEE0014E725 /* MyApp.app */, 109 | 4FADB9962C967FFF0014E725 /* MyWidgetExtension.appex */, 110 | ); 111 | name = Products; 112 | sourceTree = ""; 113 | }; 114 | 4FADB9972C967FFF0014E725 /* Frameworks */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 4FADB9982C967FFF0014E725 /* WidgetKit.framework */, 118 | 4FADB99A2C9680000014E725 /* SwiftUI.framework */, 119 | ); 120 | name = Frameworks; 121 | sourceTree = ""; 122 | }; 123 | /* End PBXGroup section */ 124 | 125 | /* Begin PBXNativeTarget section */ 126 | 4FADB9802C967FEE0014E725 /* MyApp */ = { 127 | isa = PBXNativeTarget; 128 | buildConfigurationList = 4FADB98F2C967FEF0014E725 /* Build configuration list for PBXNativeTarget "MyApp" */; 129 | buildPhases = ( 130 | 4FADB97D2C967FEE0014E725 /* Sources */, 131 | 4FADB97E2C967FEE0014E725 /* Frameworks */, 132 | 4FADB97F2C967FEE0014E725 /* Resources */, 133 | 4FADB9AB2C9680010014E725 /* Embed Foundation Extensions */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | 4FADB9A52C9680010014E725 /* PBXTargetDependency */, 139 | ); 140 | fileSystemSynchronizedGroups = ( 141 | 4FADB9832C967FEE0014E725 /* MyApp */, 142 | ); 143 | name = MyApp; 144 | packageProductDependencies = ( 145 | ); 146 | productName = MyApp; 147 | productReference = 4FADB9812C967FEE0014E725 /* MyApp.app */; 148 | productType = "com.apple.product-type.application"; 149 | }; 150 | 4FADB9952C967FFF0014E725 /* MyWidgetExtension */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = 4FADB9A82C9680010014E725 /* Build configuration list for PBXNativeTarget "MyWidgetExtension" */; 153 | buildPhases = ( 154 | 4FADB9922C967FFF0014E725 /* Sources */, 155 | 4FADB9932C967FFF0014E725 /* Frameworks */, 156 | 4FADB9942C967FFF0014E725 /* Resources */, 157 | ); 158 | buildRules = ( 159 | ); 160 | dependencies = ( 161 | ); 162 | fileSystemSynchronizedGroups = ( 163 | 4FADB99C2C9680000014E725 /* MyWidget */, 164 | ); 165 | name = MyWidgetExtension; 166 | packageProductDependencies = ( 167 | ); 168 | productName = MyWidgetExtension; 169 | productReference = 4FADB9962C967FFF0014E725 /* MyWidgetExtension.appex */; 170 | productType = "com.apple.product-type.app-extension"; 171 | }; 172 | /* End PBXNativeTarget section */ 173 | 174 | /* Begin PBXProject section */ 175 | 4FADB9792C967FEE0014E725 /* Project object */ = { 176 | isa = PBXProject; 177 | attributes = { 178 | BuildIndependentTargetsInParallel = 1; 179 | LastSwiftUpdateCheck = 1610; 180 | LastUpgradeCheck = 1610; 181 | TargetAttributes = { 182 | 4FADB9802C967FEE0014E725 = { 183 | CreatedOnToolsVersion = 16.1; 184 | LastSwiftMigration = 1610; 185 | }; 186 | 4FADB9952C967FFF0014E725 = { 187 | CreatedOnToolsVersion = 16.1; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = 4FADB97C2C967FEE0014E725 /* Build configuration list for PBXProject "MyApp" */; 192 | developmentRegion = en; 193 | hasScannedForEncodings = 0; 194 | knownRegions = ( 195 | en, 196 | Base, 197 | ); 198 | mainGroup = 4FADB9782C967FEE0014E725; 199 | minimizedProjectReferenceProxies = 1; 200 | preferredProjectObjectVersion = 77; 201 | productRefGroup = 4FADB9822C967FEE0014E725 /* Products */; 202 | projectDirPath = ""; 203 | projectRoot = ""; 204 | targets = ( 205 | 4FADB9802C967FEE0014E725 /* MyApp */, 206 | 4FADB9952C967FFF0014E725 /* MyWidgetExtension */, 207 | ); 208 | }; 209 | /* End PBXProject section */ 210 | 211 | /* Begin PBXResourcesBuildPhase section */ 212 | 4FADB97F2C967FEE0014E725 /* Resources */ = { 213 | isa = PBXResourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | 4FADB9942C967FFF0014E725 /* Resources */ = { 220 | isa = PBXResourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXResourcesBuildPhase section */ 227 | 228 | /* Begin PBXSourcesBuildPhase section */ 229 | 4FADB97D2C967FEE0014E725 /* Sources */ = { 230 | isa = PBXSourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | 4FADB9922C967FFF0014E725 /* Sources */ = { 237 | isa = PBXSourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | /* End PBXSourcesBuildPhase section */ 244 | 245 | /* Begin PBXTargetDependency section */ 246 | 4FADB9A52C9680010014E725 /* PBXTargetDependency */ = { 247 | isa = PBXTargetDependency; 248 | target = 4FADB9952C967FFF0014E725 /* MyWidgetExtension */; 249 | targetProxy = 4FADB9A42C9680010014E725 /* PBXContainerItemProxy */; 250 | }; 251 | /* End PBXTargetDependency section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 4FADB98D2C967FEF0014E725 /* Debug */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ALWAYS_SEARCH_USER_PATHS = NO; 258 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 259 | CLANG_ANALYZER_NONNULL = YES; 260 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 261 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 262 | CLANG_ENABLE_MODULES = YES; 263 | CLANG_ENABLE_OBJC_ARC = YES; 264 | CLANG_ENABLE_OBJC_WEAK = YES; 265 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 266 | CLANG_WARN_BOOL_CONVERSION = YES; 267 | CLANG_WARN_COMMA = YES; 268 | CLANG_WARN_CONSTANT_CONVERSION = YES; 269 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 270 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 271 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INFINITE_RECURSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 278 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 280 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 281 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 282 | CLANG_WARN_STRICT_PROTOTYPES = YES; 283 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 284 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 285 | CLANG_WARN_UNREACHABLE_CODE = YES; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | COPY_PHASE_STRIP = NO; 288 | DEBUG_INFORMATION_FORMAT = dwarf; 289 | ENABLE_STRICT_OBJC_MSGSEND = YES; 290 | ENABLE_TESTABILITY = YES; 291 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 292 | GCC_C_LANGUAGE_STANDARD = gnu17; 293 | GCC_DYNAMIC_NO_PIC = NO; 294 | GCC_NO_COMMON_BLOCKS = YES; 295 | GCC_OPTIMIZATION_LEVEL = 0; 296 | GCC_PREPROCESSOR_DEFINITIONS = ( 297 | "DEBUG=1", 298 | "$(inherited)", 299 | ); 300 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 301 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 302 | GCC_WARN_UNDECLARED_SELECTOR = YES; 303 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 304 | GCC_WARN_UNUSED_FUNCTION = YES; 305 | GCC_WARN_UNUSED_VARIABLE = YES; 306 | IPHONEOS_DEPLOYMENT_TARGET = 18.1; 307 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 308 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 309 | MTL_FAST_MATH = YES; 310 | ONLY_ACTIVE_ARCH = YES; 311 | SDKROOT = iphoneos; 312 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; 313 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 314 | }; 315 | name = Debug; 316 | }; 317 | 4FADB98E2C967FEF0014E725 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ALWAYS_SEARCH_USER_PATHS = NO; 321 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 322 | CLANG_ANALYZER_NONNULL = YES; 323 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 325 | CLANG_ENABLE_MODULES = YES; 326 | CLANG_ENABLE_OBJC_ARC = YES; 327 | CLANG_ENABLE_OBJC_WEAK = YES; 328 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 329 | CLANG_WARN_BOOL_CONVERSION = YES; 330 | CLANG_WARN_COMMA = YES; 331 | CLANG_WARN_CONSTANT_CONVERSION = YES; 332 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 333 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 334 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 341 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 343 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 344 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 345 | CLANG_WARN_STRICT_PROTOTYPES = YES; 346 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 347 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 348 | CLANG_WARN_UNREACHABLE_CODE = YES; 349 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 350 | COPY_PHASE_STRIP = NO; 351 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 352 | ENABLE_NS_ASSERTIONS = NO; 353 | ENABLE_STRICT_OBJC_MSGSEND = YES; 354 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 355 | GCC_C_LANGUAGE_STANDARD = gnu17; 356 | GCC_NO_COMMON_BLOCKS = YES; 357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 359 | GCC_WARN_UNDECLARED_SELECTOR = YES; 360 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 361 | GCC_WARN_UNUSED_FUNCTION = YES; 362 | GCC_WARN_UNUSED_VARIABLE = YES; 363 | IPHONEOS_DEPLOYMENT_TARGET = 18.1; 364 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 365 | MTL_ENABLE_DEBUG_INFO = NO; 366 | MTL_FAST_MATH = YES; 367 | SDKROOT = iphoneos; 368 | SWIFT_COMPILATION_MODE = wholemodule; 369 | VALIDATE_PRODUCT = YES; 370 | }; 371 | name = Release; 372 | }; 373 | 4FADB9902C967FEF0014E725 /* Debug */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 377 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 378 | CLANG_ENABLE_MODULES = YES; 379 | CODE_SIGN_STYLE = Automatic; 380 | CURRENT_PROJECT_VERSION = 1; 381 | DEVELOPMENT_ASSET_PATHS = "\"MyApp/Preview Content\""; 382 | DEVELOPMENT_TEAM = P53D29U9LJ; 383 | ENABLE_PREVIEWS = YES; 384 | GENERATE_INFOPLIST_FILE = YES; 385 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 386 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 387 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 388 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 389 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 390 | LD_RUNPATH_SEARCH_PATHS = ( 391 | "$(inherited)", 392 | "@executable_path/Frameworks", 393 | ); 394 | MARKETING_VERSION = 1.0; 395 | PRODUCT_BUNDLE_IDENTIFIER = com.pookjw.MyApp; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | SWIFT_EMIT_LOC_STRINGS = YES; 398 | SWIFT_OBJC_BRIDGING_HEADER = "MyWidget/MyApp-Bridging-Header.h"; 399 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 400 | SWIFT_VERSION = 5.0; 401 | TARGETED_DEVICE_FAMILY = "1,2"; 402 | }; 403 | name = Debug; 404 | }; 405 | 4FADB9912C967FEF0014E725 /* Release */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 409 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 410 | CLANG_ENABLE_MODULES = YES; 411 | CODE_SIGN_STYLE = Automatic; 412 | CURRENT_PROJECT_VERSION = 1; 413 | DEVELOPMENT_ASSET_PATHS = "\"MyApp/Preview Content\""; 414 | DEVELOPMENT_TEAM = P53D29U9LJ; 415 | ENABLE_PREVIEWS = YES; 416 | GENERATE_INFOPLIST_FILE = YES; 417 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 418 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 419 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 420 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 421 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 422 | LD_RUNPATH_SEARCH_PATHS = ( 423 | "$(inherited)", 424 | "@executable_path/Frameworks", 425 | ); 426 | MARKETING_VERSION = 1.0; 427 | PRODUCT_BUNDLE_IDENTIFIER = com.pookjw.MyApp; 428 | PRODUCT_NAME = "$(TARGET_NAME)"; 429 | SWIFT_EMIT_LOC_STRINGS = YES; 430 | SWIFT_OBJC_BRIDGING_HEADER = "MyWidget/MyApp-Bridging-Header.h"; 431 | SWIFT_VERSION = 5.0; 432 | TARGETED_DEVICE_FAMILY = "1,2"; 433 | }; 434 | name = Release; 435 | }; 436 | 4FADB9A92C9680010014E725 /* Debug */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 440 | ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; 441 | CODE_SIGN_STYLE = Automatic; 442 | CURRENT_PROJECT_VERSION = 1; 443 | DEVELOPMENT_TEAM = P53D29U9LJ; 444 | GENERATE_INFOPLIST_FILE = YES; 445 | INFOPLIST_FILE = MyWidget/Info.plist; 446 | INFOPLIST_KEY_CFBundleDisplayName = MyWidget; 447 | INFOPLIST_KEY_NSHumanReadableCopyright = ""; 448 | LD_RUNPATH_SEARCH_PATHS = ( 449 | "$(inherited)", 450 | "@executable_path/Frameworks", 451 | "@executable_path/../../Frameworks", 452 | ); 453 | MARKETING_VERSION = 1.0; 454 | PRODUCT_BUNDLE_IDENTIFIER = com.pookjw.MyApp.MyWidget; 455 | PRODUCT_NAME = "$(TARGET_NAME)"; 456 | SKIP_INSTALL = YES; 457 | SWIFT_EMIT_LOC_STRINGS = YES; 458 | SWIFT_VERSION = 5.0; 459 | TARGETED_DEVICE_FAMILY = "1,2"; 460 | }; 461 | name = Debug; 462 | }; 463 | 4FADB9AA2C9680010014E725 /* Release */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 467 | ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; 468 | CODE_SIGN_STYLE = Automatic; 469 | CURRENT_PROJECT_VERSION = 1; 470 | DEVELOPMENT_TEAM = P53D29U9LJ; 471 | GENERATE_INFOPLIST_FILE = YES; 472 | INFOPLIST_FILE = MyWidget/Info.plist; 473 | INFOPLIST_KEY_CFBundleDisplayName = MyWidget; 474 | INFOPLIST_KEY_NSHumanReadableCopyright = ""; 475 | LD_RUNPATH_SEARCH_PATHS = ( 476 | "$(inherited)", 477 | "@executable_path/Frameworks", 478 | "@executable_path/../../Frameworks", 479 | ); 480 | MARKETING_VERSION = 1.0; 481 | PRODUCT_BUNDLE_IDENTIFIER = com.pookjw.MyApp.MyWidget; 482 | PRODUCT_NAME = "$(TARGET_NAME)"; 483 | SKIP_INSTALL = YES; 484 | SWIFT_EMIT_LOC_STRINGS = YES; 485 | SWIFT_VERSION = 5.0; 486 | TARGETED_DEVICE_FAMILY = "1,2"; 487 | }; 488 | name = Release; 489 | }; 490 | /* End XCBuildConfiguration section */ 491 | 492 | /* Begin XCConfigurationList section */ 493 | 4FADB97C2C967FEE0014E725 /* Build configuration list for PBXProject "MyApp" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 4FADB98D2C967FEF0014E725 /* Debug */, 497 | 4FADB98E2C967FEF0014E725 /* Release */, 498 | ); 499 | defaultConfigurationIsVisible = 0; 500 | defaultConfigurationName = Release; 501 | }; 502 | 4FADB98F2C967FEF0014E725 /* Build configuration list for PBXNativeTarget "MyApp" */ = { 503 | isa = XCConfigurationList; 504 | buildConfigurations = ( 505 | 4FADB9902C967FEF0014E725 /* Debug */, 506 | 4FADB9912C967FEF0014E725 /* Release */, 507 | ); 508 | defaultConfigurationIsVisible = 0; 509 | defaultConfigurationName = Release; 510 | }; 511 | 4FADB9A82C9680010014E725 /* Build configuration list for PBXNativeTarget "MyWidgetExtension" */ = { 512 | isa = XCConfigurationList; 513 | buildConfigurations = ( 514 | 4FADB9A92C9680010014E725 /* Debug */, 515 | 4FADB9AA2C9680010014E725 /* Release */, 516 | ); 517 | defaultConfigurationIsVisible = 0; 518 | defaultConfigurationName = Release; 519 | }; 520 | /* End XCConfigurationList section */ 521 | }; 522 | rootObject = 4FADB9792C967FEE0014E725 /* Project object */; 523 | } 524 | -------------------------------------------------------------------------------- /MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MyApp.xcodeproj/xcshareddata/xcschemes/MyApp.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | 10 | 16 | 22 | 23 | 24 | 25 | 26 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /MyApp.xcodeproj/xcshareddata/xcschemes/MyWidgetExtension.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 11 | 17 | 23 | 24 | 25 | 31 | 37 | 38 | 39 | 40 | 41 | 47 | 48 | 60 | 63 | 69 | 70 | 71 | 72 | 78 | 79 | 80 | 81 | 85 | 86 | 90 | 91 | 95 | 96 | 100 | 101 | 102 | 103 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /MyApp/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MyApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | }, 8 | { 9 | "appearances" : [ 10 | { 11 | "appearance" : "luminosity", 12 | "value" : "dark" 13 | } 14 | ], 15 | "idiom" : "universal", 16 | "platform" : "ios", 17 | "size" : "1024x1024" 18 | }, 19 | { 20 | "appearances" : [ 21 | { 22 | "appearance" : "luminosity", 23 | "value" : "tinted" 24 | } 25 | ], 26 | "idiom" : "universal", 27 | "platform" : "ios", 28 | "size" : "1024x1024" 29 | } 30 | ], 31 | "info" : { 32 | "author" : "xcode", 33 | "version" : 1 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /MyApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /MyApp/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // MyApp 4 | // 5 | // Created by Jinwoo Kim on 9/15/24. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | var body: some View { 12 | VStack { 13 | Image(systemName: "globe") 14 | .imageScale(.large) 15 | .foregroundStyle(.tint) 16 | Text("Hello, world!") 17 | } 18 | .padding() 19 | } 20 | } 21 | 22 | #Preview { 23 | ContentView() 24 | } 25 | -------------------------------------------------------------------------------- /MyApp/MyAppApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MyAppApp.swift 3 | // MyApp 4 | // 5 | // Created by Jinwoo Kim on 9/15/24. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct MyAppApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /MyApp/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /MyWidget/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MyWidget/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | }, 8 | { 9 | "appearances" : [ 10 | { 11 | "appearance" : "luminosity", 12 | "value" : "dark" 13 | } 14 | ], 15 | "idiom" : "universal", 16 | "platform" : "ios", 17 | "size" : "1024x1024" 18 | }, 19 | { 20 | "appearances" : [ 21 | { 22 | "appearance" : "luminosity", 23 | "value" : "tinted" 24 | } 25 | ], 26 | "idiom" : "universal", 27 | "platform" : "ios", 28 | "size" : "1024x1024" 29 | } 30 | ], 31 | "info" : { 32 | "author" : "xcode", 33 | "version" : 1 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /MyWidget/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /MyWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MyWidget/FooObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // FooObject.h 3 | // MyApp 4 | // 5 | // Created by Jinwoo Kim on 9/15/24. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface FooObject : NSObject 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /MyWidget/FooObject.mm: -------------------------------------------------------------------------------- 1 | // 2 | // FooObject.mm 3 | // MyApp 4 | // 5 | // Created by Jinwoo Kim on 9/15/24. 6 | // 7 | 8 | #import "FooObject.h" 9 | #import 10 | #import 11 | 12 | @interface MyDescriptorFetchResult : NSObject { 13 | NSArray *_activityDescriptors; 14 | NSArray *_controlDescriptors; 15 | NSArray *_widgetDescriptors; 16 | } 17 | @end 18 | @implementation MyDescriptorFetchResult 19 | 20 | + (BOOL)supportsSecureCoding { 21 | return YES; 22 | } 23 | 24 | - (instancetype)initWithCoder:(NSCoder *)coder { 25 | if (self = [super init]) { 26 | NSArray *activityDescriptors = [coder decodeObjectOfClasses:[NSSet setWithObjects:NSArray.class, objc_lookUpClass("CHSWidgetDescriptor"), nil] forKey:@"activityDescriptors"]; 27 | NSArray *controlDescriptors = [coder decodeObjectOfClasses:[NSSet setWithObjects:NSArray.class, objc_lookUpClass("CHSControlDescriptor"), nil] forKey:@"controlDescriptors"]; 28 | NSArray *widgetDescriptors = [coder decodeObjectOfClasses:[NSSet setWithObjects:NSArray.class, objc_lookUpClass("CHSWidgetDescriptor"), nil] forKey:@"widgetDescriptors"]; 29 | 30 | // 31 | 32 | NSMutableArray *newWidgetDescriptors = [[NSMutableArray alloc] initWithCapacity:widgetDescriptors.count]; 33 | 34 | for (id widgetDescriptor in widgetDescriptors) { 35 | NSString *kind = reinterpret_cast(objc_msgSend)(widgetDescriptor, sel_registerName("kind")); 36 | 37 | if ([kind isEqualToString:@"MyClearWidget"]) { 38 | id mutableWidgetDescriptor = [widgetDescriptor mutableCopy]; 39 | reinterpret_cast(objc_msgSend)(mutableWidgetDescriptor, sel_registerName("setBackgroundRemovable:"), YES); 40 | reinterpret_cast(objc_msgSend)(mutableWidgetDescriptor, sel_registerName("setTransparent:"), YES); 41 | reinterpret_cast(objc_msgSend)(mutableWidgetDescriptor, sel_registerName("setPreferredBackgroundStyle:"), 0x1); 42 | [newWidgetDescriptors addObject:mutableWidgetDescriptor]; 43 | [mutableWidgetDescriptor release]; 44 | } else if ([kind isEqualToString:@"MyBlurWidget"]) { 45 | id mutableWidgetDescriptor = [widgetDescriptor mutableCopy]; 46 | reinterpret_cast(objc_msgSend)(mutableWidgetDescriptor, sel_registerName("setBackgroundRemovable:"), YES); 47 | reinterpret_cast(objc_msgSend)(mutableWidgetDescriptor, sel_registerName("setTransparent:"), YES); 48 | reinterpret_cast(objc_msgSend)(mutableWidgetDescriptor, sel_registerName("setSupportsVibrantContent:"), YES); 49 | reinterpret_cast(objc_msgSend)(mutableWidgetDescriptor, sel_registerName("setPreferredBackgroundStyle:"), 0x2); 50 | [newWidgetDescriptors addObject:mutableWidgetDescriptor]; 51 | [mutableWidgetDescriptor release]; 52 | } else { 53 | [newWidgetDescriptors addObject:widgetDescriptor]; 54 | } 55 | } 56 | 57 | _widgetDescriptors = [newWidgetDescriptors copy]; 58 | [newWidgetDescriptors release]; 59 | _controlDescriptors = [controlDescriptors retain]; 60 | _activityDescriptors = [activityDescriptors retain]; 61 | } 62 | 63 | return self; 64 | } 65 | 66 | - (void)dealloc { 67 | [_activityDescriptors release]; 68 | [_controlDescriptors release]; 69 | [_widgetDescriptors release]; 70 | [super dealloc]; 71 | } 72 | 73 | - (void)encodeWithCoder:(NSCoder *)coder { 74 | [coder encodeObject:_activityDescriptors forKey:@"activityDescriptors"]; 75 | [coder encodeObject:_controlDescriptors forKey:@"controlDescriptors"]; 76 | [coder encodeObject:_widgetDescriptors forKey:@"widgetDescriptors"]; 77 | } 78 | 79 | @end 80 | 81 | namespace custom_ExportedObject { 82 | namespace getAllCurrentDescriptorsWithCompletion { 83 | void (*original)(id, SEL, id); 84 | void custom(id self, SEL _cmd, void (^completion)(id fetchResult)) { 85 | original(self, _cmd, ^(id fetchResult_1) { 86 | NSError * _Nullable error = nil; 87 | 88 | NSKeyedArchiver *archiver_1 = [[NSKeyedArchiver alloc] initRequiringSecureCoding:YES]; 89 | [fetchResult_1 encodeWithCoder:archiver_1]; 90 | 91 | NSData *encodedData_1 = archiver_1.encodedData; 92 | [archiver_1 release]; 93 | 94 | // 95 | 96 | NSKeyedUnarchiver *unarchiver_1 = [[NSKeyedUnarchiver alloc] initForReadingFromData:encodedData_1 error:&error]; 97 | if (error != nil) { 98 | completion(fetchResult_1); 99 | [unarchiver_1 release]; 100 | return; 101 | } 102 | 103 | MyDescriptorFetchResult *fetchResult_2 = [[MyDescriptorFetchResult alloc] initWithCoder:unarchiver_1]; 104 | [unarchiver_1 release]; 105 | 106 | NSKeyedArchiver *archiver_2 = [[NSKeyedArchiver alloc] initRequiringSecureCoding:YES]; 107 | [fetchResult_2 encodeWithCoder:archiver_2]; 108 | [fetchResult_2 release]; 109 | NSData *encodedData_2 = archiver_2.encodedData; 110 | [archiver_2 release]; 111 | 112 | // 113 | 114 | NSKeyedUnarchiver *unarchiver_3 = [[NSKeyedUnarchiver alloc] initForReadingFromData:encodedData_2 error:&error]; 115 | if (error != nil) { 116 | [unarchiver_3 release]; 117 | completion(fetchResult_1); 118 | return; 119 | } 120 | 121 | id fetchResult_3 = reinterpret_cast(objc_msgSend)([objc_lookUpClass("_TtC9WidgetKit21DescriptorFetchResult") alloc], @selector(initWithCoder:), unarchiver_3); 122 | [unarchiver_3 release]; 123 | 124 | completion(fetchResult_3); 125 | [fetchResult_3 release]; 126 | }); 127 | } 128 | void swizzle() { 129 | Method method = class_getInstanceMethod(objc_lookUpClass("_TtCC9WidgetKit24WidgetExtensionXPCServer14ExportedObject"), sel_registerName("getAllCurrentDescriptorsWithCompletion:")); 130 | original = reinterpret_cast(method_getImplementation(method)); 131 | method_setImplementation(method, reinterpret_cast(custom)); 132 | } 133 | } 134 | } 135 | 136 | @implementation FooObject 137 | 138 | + (void)load { 139 | custom_ExportedObject::getAllCurrentDescriptorsWithCompletion::swizzle(); 140 | } 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /MyWidget/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSExtension 6 | 7 | NSExtensionPointIdentifier 8 | com.apple.widgetkit-extension 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /MyWidget/MyApp-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /MyWidget/MyWidget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MyWidget.swift 3 | // MyWidget 4 | // 5 | // Created by Jinwoo Kim on 9/15/24. 6 | // 7 | 8 | import WidgetKit 9 | import SwiftUI 10 | 11 | struct Provider: TimelineProvider { 12 | func placeholder(in context: Context) -> SimpleEntry { 13 | SimpleEntry(date: Date(), emoji: "😀") 14 | } 15 | 16 | func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) { 17 | let entry = SimpleEntry(date: Date(), emoji: "😀") 18 | completion(entry) 19 | } 20 | 21 | func getTimeline(in context: Context, completion: @escaping (Timeline) -> ()) { 22 | var entries: [SimpleEntry] = [] 23 | 24 | // Generate a timeline consisting of five entries an hour apart, starting from the current date. 25 | let currentDate = Date() 26 | for hourOffset in 0 ..< 5 { 27 | let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)! 28 | let entry = SimpleEntry(date: entryDate, emoji: "😀") 29 | entries.append(entry) 30 | } 31 | 32 | let timeline = Timeline(entries: entries, policy: .atEnd) 33 | completion(timeline) 34 | } 35 | 36 | // func relevances() async -> WidgetRelevances { 37 | // // Generate a list containing the contexts this widget is relevant in. 38 | // } 39 | } 40 | 41 | struct SimpleEntry: TimelineEntry { 42 | let date: Date 43 | let emoji: String 44 | } 45 | 46 | struct MyWidgetEntryView : View { 47 | var entry: Provider.Entry 48 | 49 | var body: some View { 50 | VStack { 51 | Text("Time:") 52 | Text(entry.date, style: .time) 53 | 54 | Text("Emoji:") 55 | Text(entry.emoji) 56 | } 57 | } 58 | } 59 | 60 | struct MyNormalWidget: Widget { 61 | let kind: String = "MyNormalWidget" 62 | 63 | var body: some WidgetConfiguration { 64 | StaticConfiguration(kind: kind, provider: Provider()) { entry in 65 | MyWidgetEntryView(entry: entry) 66 | .containerBackground(.clear, for: .widget) 67 | } 68 | .configurationDisplayName("My Widget") 69 | .description("This is an example widget.") 70 | } 71 | } 72 | 73 | struct MyClearWidget: Widget { 74 | let kind: String = "MyClearWidget" 75 | 76 | var body: some WidgetConfiguration { 77 | StaticConfiguration(kind: kind, provider: Provider()) { entry in 78 | MyWidgetEntryView(entry: entry) 79 | .containerBackground(.clear, for: .widget) 80 | } 81 | .configurationDisplayName("My Widget") 82 | .description("This is an example widget.") 83 | } 84 | } 85 | 86 | struct MyBlurWidget: Widget { 87 | let kind: String = "MyBlurWidget" 88 | 89 | var body: some WidgetConfiguration { 90 | StaticConfiguration(kind: kind, provider: Provider()) { entry in 91 | MyWidgetEntryView(entry: entry) 92 | .containerBackground(.clear, for: .widget) 93 | } 94 | .configurationDisplayName("My Widget") 95 | .description("This is an example widget.") 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /MyWidget/MyWidgetBundle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MyWidgetBundle.swift 3 | // MyWidget 4 | // 5 | // Created by Jinwoo Kim on 9/15/24. 6 | // 7 | 8 | import WidgetKit 9 | import SwiftUI 10 | 11 | @main 12 | struct MyWidgetBundle: WidgetBundle { 13 | init() {} 14 | 15 | @WidgetBundleBuilder 16 | var body: some Widget { 17 | MyNormalWidget() 18 | MyClearWidget() 19 | MyBlurWidget() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ClearAndBlurredWidgets 2 | 3 | ![](0.png) 4 | --------------------------------------------------------------------------------