From 57e2ec151ed5763d7a943f83df31971ab39e929a Mon Sep 17 00:00:00 2001 From: Alan Francis Date: Sun, 11 Jun 2023 13:45:01 +0100 Subject: [PATCH] End of Step 7: Initial Add of Three Widgets --- JustOneThing.xcodeproj/project.pbxproj | 510 ++++++++++++++++++ .../xcschemes/xcschememanagement.plist | 19 +- .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 58 ++ MacWidget/Assets.xcassets/Contents.json | 6 + .../WidgetBackground.colorset/Contents.json | 11 + MacWidget/Info.plist | 11 + MacWidget/MacWidget.entitlements | 8 + MacWidget/MacWidget.intentdefinition | 59 ++ MacWidget/MacWidget.swift | 69 +++ .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 13 + PhoneWidget/Assets.xcassets/Contents.json | 6 + .../WidgetBackground.colorset/Contents.json | 11 + PhoneWidget/Info.plist | 11 + PhoneWidget/PhoneWidget.intentdefinition | 59 ++ PhoneWidget/PhoneWidget.swift | 68 +++ PhoneWidget/PhoneWidgetBundle.swift | 16 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 13 + WatchWidget/Assets.xcassets/Contents.json | 6 + .../WidgetBackground.colorset/Contents.json | 11 + WatchWidget/Info.plist | 11 + WatchWidget/WatchWidget.intentdefinition | 59 ++ WatchWidget/WatchWidget.swift | 75 +++ 25 files changed, 1141 insertions(+), 2 deletions(-) create mode 100644 MacWidget/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 MacWidget/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 MacWidget/Assets.xcassets/Contents.json create mode 100644 MacWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json create mode 100644 MacWidget/Info.plist create mode 100644 MacWidget/MacWidget.entitlements create mode 100644 MacWidget/MacWidget.intentdefinition create mode 100644 MacWidget/MacWidget.swift create mode 100644 PhoneWidget/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 PhoneWidget/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 PhoneWidget/Assets.xcassets/Contents.json create mode 100644 PhoneWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json create mode 100644 PhoneWidget/Info.plist create mode 100644 PhoneWidget/PhoneWidget.intentdefinition create mode 100644 PhoneWidget/PhoneWidget.swift create mode 100644 PhoneWidget/PhoneWidgetBundle.swift create mode 100644 WatchWidget/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 WatchWidget/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 WatchWidget/Assets.xcassets/Contents.json create mode 100644 WatchWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json create mode 100644 WatchWidget/Info.plist create mode 100644 WatchWidget/WatchWidget.intentdefinition create mode 100644 WatchWidget/WatchWidget.swift diff --git a/JustOneThing.xcodeproj/project.pbxproj b/JustOneThing.xcodeproj/project.pbxproj index 60725aa..29b54c5 100644 --- a/JustOneThing.xcodeproj/project.pbxproj +++ b/JustOneThing.xcodeproj/project.pbxproj @@ -14,6 +14,28 @@ 5483903B2A2A773900BF5624 /* JustOneThingApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5483903A2A2A773900BF5624 /* JustOneThingApp.swift */; }; 5483903D2A2A773900BF5624 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5483903C2A2A773900BF5624 /* ContentView.swift */; }; 5483903F2A2A773A00BF5624 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5483903E2A2A773A00BF5624 /* Assets.xcassets */; }; + 54928C162A35F89900095445 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54928C152A35F89900095445 /* WidgetKit.framework */; }; + 54928C182A35F89900095445 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54928C172A35F89900095445 /* SwiftUI.framework */; }; + 54928C1B2A35F89900095445 /* MacWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54928C1A2A35F89900095445 /* MacWidget.swift */; }; + 54928C1E2A35F89A00095445 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 54928C1D2A35F89A00095445 /* Assets.xcassets */; }; + 54928C212A35F89A00095445 /* MacWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 54928C1C2A35F89900095445 /* MacWidget.intentdefinition */; }; + 54928C222A35F89A00095445 /* MacWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 54928C1C2A35F89900095445 /* MacWidget.intentdefinition */; }; + 54928C252A35F89A00095445 /* MacWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 54928C132A35F89900095445 /* MacWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 54928C2F2A35F8B800095445 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54928C152A35F89900095445 /* WidgetKit.framework */; }; + 54928C302A35F8B800095445 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54928C172A35F89900095445 /* SwiftUI.framework */; }; + 54928C332A35F8B800095445 /* PhoneWidgetBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54928C322A35F8B800095445 /* PhoneWidgetBundle.swift */; }; + 54928C352A35F8B800095445 /* PhoneWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54928C342A35F8B800095445 /* PhoneWidget.swift */; }; + 54928C382A35F8B800095445 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 54928C372A35F8B800095445 /* Assets.xcassets */; }; + 54928C3A2A35F8B800095445 /* PhoneWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 54928C362A35F8B800095445 /* PhoneWidget.intentdefinition */; }; + 54928C3B2A35F8B800095445 /* PhoneWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 54928C362A35F8B800095445 /* PhoneWidget.intentdefinition */; }; + 54928C3E2A35F8B800095445 /* PhoneWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 54928C2E2A35F8B800095445 /* PhoneWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 54928C472A35F8CB00095445 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54928C152A35F89900095445 /* WidgetKit.framework */; }; + 54928C482A35F8CB00095445 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54928C172A35F89900095445 /* SwiftUI.framework */; }; + 54928C4B2A35F8CB00095445 /* WatchWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54928C4A2A35F8CB00095445 /* WatchWidget.swift */; }; + 54928C4E2A35F8CC00095445 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 54928C4D2A35F8CC00095445 /* Assets.xcassets */; }; + 54928C502A35F8CC00095445 /* WatchWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 54928C4C2A35F8CB00095445 /* WatchWidget.intentdefinition */; }; + 54928C512A35F8CC00095445 /* WatchWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 54928C4C2A35F8CB00095445 /* WatchWidget.intentdefinition */; }; + 54928C542A35F8CC00095445 /* WatchWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 54928C462A35F8CB00095445 /* WatchWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -24,6 +46,27 @@ remoteGlobalIDString = 5431ED6C2A2A77C900515680; remoteInfo = "JustOneThingWatch Watch App"; }; + 54928C232A35F89A00095445 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5483902F2A2A773900BF5624 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 54928C122A35F89900095445; + remoteInfo = MacWidgetExtension; + }; + 54928C3C2A35F8B800095445 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5483902F2A2A773900BF5624 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 54928C2D2A35F8B800095445; + remoteInfo = PhoneWidgetExtension; + }; + 54928C522A35F8CC00095445 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5483902F2A2A773900BF5624 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 54928C452A35F8CB00095445; + remoteInfo = WatchWidgetExtension; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -38,6 +81,29 @@ name = "Embed Watch Content"; runOnlyForDeploymentPostprocessing = 0; }; + 54928C262A35F89A00095445 /* Embed Foundation Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 54928C252A35F89A00095445 /* MacWidgetExtension.appex in Embed Foundation Extensions */, + 54928C3E2A35F8B800095445 /* PhoneWidgetExtension.appex in Embed Foundation Extensions */, + ); + name = "Embed Foundation Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; + 54928C582A35F8CC00095445 /* Embed Foundation Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 54928C542A35F8CC00095445 /* WatchWidgetExtension.appex in Embed Foundation Extensions */, + ); + name = "Embed Foundation Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -48,6 +114,25 @@ 5483903C2A2A773900BF5624 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 5483903E2A2A773A00BF5624 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 548390402A2A773A00BF5624 /* JustOneThing.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = JustOneThing.entitlements; sourceTree = ""; }; + 54928C132A35F89900095445 /* MacWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = MacWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 54928C152A35F89900095445 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; + 54928C172A35F89900095445 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; + 54928C1A2A35F89900095445 /* MacWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacWidget.swift; sourceTree = ""; }; + 54928C1C2A35F89900095445 /* MacWidget.intentdefinition */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; path = MacWidget.intentdefinition; sourceTree = ""; }; + 54928C1D2A35F89A00095445 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 54928C1F2A35F89A00095445 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 54928C202A35F89A00095445 /* MacWidget.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MacWidget.entitlements; sourceTree = ""; }; + 54928C2E2A35F8B800095445 /* PhoneWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = PhoneWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 54928C322A35F8B800095445 /* PhoneWidgetBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneWidgetBundle.swift; sourceTree = ""; }; + 54928C342A35F8B800095445 /* PhoneWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneWidget.swift; sourceTree = ""; }; + 54928C362A35F8B800095445 /* PhoneWidget.intentdefinition */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; path = PhoneWidget.intentdefinition; sourceTree = ""; }; + 54928C372A35F8B800095445 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 54928C392A35F8B800095445 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 54928C462A35F8CB00095445 /* WatchWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = WatchWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 54928C4A2A35F8CB00095445 /* WatchWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchWidget.swift; sourceTree = ""; }; + 54928C4C2A35F8CB00095445 /* WatchWidget.intentdefinition */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; path = WatchWidget.intentdefinition; sourceTree = ""; }; + 54928C4D2A35F8CC00095445 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 54928C4F2A35F8CC00095445 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -65,6 +150,33 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 54928C102A35F89900095445 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 54928C182A35F89900095445 /* SwiftUI.framework in Frameworks */, + 54928C162A35F89900095445 /* WidgetKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 54928C2B2A35F8B800095445 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 54928C302A35F8B800095445 /* SwiftUI.framework in Frameworks */, + 54928C2F2A35F8B800095445 /* WidgetKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 54928C432A35F8CB00095445 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 54928C482A35F8CB00095445 /* SwiftUI.framework in Frameworks */, + 54928C472A35F8CB00095445 /* WidgetKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -92,6 +204,10 @@ 5407E5012A2A8A5100EF00B8 /* AppShared */, 548390392A2A773900BF5624 /* JustOneThing */, 5431ED6E2A2A77C900515680 /* JustOneThingWatch Watch App */, + 54928C192A35F89900095445 /* MacWidget */, + 54928C312A35F8B800095445 /* PhoneWidget */, + 54928C492A35F8CB00095445 /* WatchWidget */, + 54928C142A35F89900095445 /* Frameworks */, 548390382A2A773900BF5624 /* Products */, ); sourceTree = ""; @@ -101,6 +217,9 @@ children = ( 548390372A2A773900BF5624 /* JustOneThing.app */, 5431ED6D2A2A77C900515680 /* JustOneThingWatch Watch App.app */, + 54928C132A35F89900095445 /* MacWidgetExtension.appex */, + 54928C2E2A35F8B800095445 /* PhoneWidgetExtension.appex */, + 54928C462A35F8CB00095445 /* WatchWidgetExtension.appex */, ); name = Products; sourceTree = ""; @@ -113,6 +232,50 @@ path = JustOneThing; sourceTree = ""; }; + 54928C142A35F89900095445 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 54928C152A35F89900095445 /* WidgetKit.framework */, + 54928C172A35F89900095445 /* SwiftUI.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 54928C192A35F89900095445 /* MacWidget */ = { + isa = PBXGroup; + children = ( + 54928C1A2A35F89900095445 /* MacWidget.swift */, + 54928C1C2A35F89900095445 /* MacWidget.intentdefinition */, + 54928C1D2A35F89A00095445 /* Assets.xcassets */, + 54928C1F2A35F89A00095445 /* Info.plist */, + 54928C202A35F89A00095445 /* MacWidget.entitlements */, + ); + path = MacWidget; + sourceTree = ""; + }; + 54928C312A35F8B800095445 /* PhoneWidget */ = { + isa = PBXGroup; + children = ( + 54928C322A35F8B800095445 /* PhoneWidgetBundle.swift */, + 54928C342A35F8B800095445 /* PhoneWidget.swift */, + 54928C362A35F8B800095445 /* PhoneWidget.intentdefinition */, + 54928C372A35F8B800095445 /* Assets.xcassets */, + 54928C392A35F8B800095445 /* Info.plist */, + ); + path = PhoneWidget; + sourceTree = ""; + }; + 54928C492A35F8CB00095445 /* WatchWidget */ = { + isa = PBXGroup; + children = ( + 54928C4A2A35F8CB00095445 /* WatchWidget.swift */, + 54928C4C2A35F8CB00095445 /* WatchWidget.intentdefinition */, + 54928C4D2A35F8CC00095445 /* Assets.xcassets */, + 54928C4F2A35F8CC00095445 /* Info.plist */, + ); + path = WatchWidget; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -123,10 +286,12 @@ 5431ED692A2A77C900515680 /* Sources */, 5431ED6A2A2A77C900515680 /* Frameworks */, 5431ED6B2A2A77C900515680 /* Resources */, + 54928C582A35F8CC00095445 /* Embed Foundation Extensions */, ); buildRules = ( ); dependencies = ( + 54928C532A35F8CC00095445 /* PBXTargetDependency */, ); name = "JustOneThingWatch Watch App"; productName = "JustOneThingWatch Watch App"; @@ -141,17 +306,71 @@ 548390342A2A773900BF5624 /* Frameworks */, 548390352A2A773900BF5624 /* Resources */, 5431ED7B2A2A77CA00515680 /* Embed Watch Content */, + 54928C262A35F89A00095445 /* Embed Foundation Extensions */, ); buildRules = ( ); dependencies = ( 5431ED792A2A77CA00515680 /* PBXTargetDependency */, + 54928C242A35F89A00095445 /* PBXTargetDependency */, + 54928C3D2A35F8B800095445 /* PBXTargetDependency */, ); name = JustOneThing; productName = JustOneThing; productReference = 548390372A2A773900BF5624 /* JustOneThing.app */; productType = "com.apple.product-type.application"; }; + 54928C122A35F89900095445 /* MacWidgetExtension */ = { + isa = PBXNativeTarget; + buildConfigurationList = 54928C292A35F89A00095445 /* Build configuration list for PBXNativeTarget "MacWidgetExtension" */; + buildPhases = ( + 54928C0F2A35F89900095445 /* Sources */, + 54928C102A35F89900095445 /* Frameworks */, + 54928C112A35F89900095445 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MacWidgetExtension; + productName = MacWidgetExtension; + productReference = 54928C132A35F89900095445 /* MacWidgetExtension.appex */; + productType = "com.apple.product-type.app-extension"; + }; + 54928C2D2A35F8B800095445 /* PhoneWidgetExtension */ = { + isa = PBXNativeTarget; + buildConfigurationList = 54928C3F2A35F8B800095445 /* Build configuration list for PBXNativeTarget "PhoneWidgetExtension" */; + buildPhases = ( + 54928C2A2A35F8B800095445 /* Sources */, + 54928C2B2A35F8B800095445 /* Frameworks */, + 54928C2C2A35F8B800095445 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PhoneWidgetExtension; + productName = PhoneWidgetExtension; + productReference = 54928C2E2A35F8B800095445 /* PhoneWidgetExtension.appex */; + productType = "com.apple.product-type.app-extension"; + }; + 54928C452A35F8CB00095445 /* WatchWidgetExtension */ = { + isa = PBXNativeTarget; + buildConfigurationList = 54928C552A35F8CC00095445 /* Build configuration list for PBXNativeTarget "WatchWidgetExtension" */; + buildPhases = ( + 54928C422A35F8CB00095445 /* Sources */, + 54928C432A35F8CB00095445 /* Frameworks */, + 54928C442A35F8CB00095445 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = WatchWidgetExtension; + productName = WatchWidgetExtension; + productReference = 54928C462A35F8CB00095445 /* WatchWidgetExtension.appex */; + productType = "com.apple.product-type.app-extension"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -168,6 +387,15 @@ 548390362A2A773900BF5624 = { CreatedOnToolsVersion = 14.3.1; }; + 54928C122A35F89900095445 = { + CreatedOnToolsVersion = 14.3.1; + }; + 54928C2D2A35F8B800095445 = { + CreatedOnToolsVersion = 14.3.1; + }; + 54928C452A35F8CB00095445 = { + CreatedOnToolsVersion = 14.3.1; + }; }; }; buildConfigurationList = 548390322A2A773900BF5624 /* Build configuration list for PBXProject "JustOneThing" */; @@ -185,6 +413,9 @@ targets = ( 548390362A2A773900BF5624 /* JustOneThing */, 5431ED6C2A2A77C900515680 /* JustOneThingWatch Watch App */, + 54928C122A35F89900095445 /* MacWidgetExtension */, + 54928C2D2A35F8B800095445 /* PhoneWidgetExtension */, + 54928C452A35F8CB00095445 /* WatchWidgetExtension */, ); }; /* End PBXProject section */ @@ -206,6 +437,30 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 54928C112A35F89900095445 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 54928C1E2A35F89A00095445 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 54928C2C2A35F8B800095445 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 54928C382A35F8B800095445 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 54928C442A35F8CB00095445 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 54928C4E2A35F8CC00095445 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -214,6 +469,7 @@ buildActionMask = 2147483647; files = ( 5407E5032A2A8AE700EF00B8 /* ContentView.swift in Sources */, + 54928C512A35F8CC00095445 /* WatchWidget.intentdefinition in Sources */, 5407E5022A2A8AE200EF00B8 /* JustOneThingApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -224,6 +480,36 @@ files = ( 5483903D2A2A773900BF5624 /* ContentView.swift in Sources */, 5483903B2A2A773900BF5624 /* JustOneThingApp.swift in Sources */, + 54928C222A35F89A00095445 /* MacWidget.intentdefinition in Sources */, + 54928C3B2A35F8B800095445 /* PhoneWidget.intentdefinition in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 54928C0F2A35F89900095445 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 54928C212A35F89A00095445 /* MacWidget.intentdefinition in Sources */, + 54928C1B2A35F89900095445 /* MacWidget.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 54928C2A2A35F8B800095445 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 54928C352A35F8B800095445 /* PhoneWidget.swift in Sources */, + 54928C3A2A35F8B800095445 /* PhoneWidget.intentdefinition in Sources */, + 54928C332A35F8B800095445 /* PhoneWidgetBundle.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 54928C422A35F8CB00095445 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 54928C502A35F8CC00095445 /* WatchWidget.intentdefinition in Sources */, + 54928C4B2A35F8CB00095445 /* WatchWidget.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -236,12 +522,28 @@ target = 5431ED6C2A2A77C900515680 /* JustOneThingWatch Watch App */; targetProxy = 5431ED782A2A77CA00515680 /* PBXContainerItemProxy */; }; + 54928C242A35F89A00095445 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 54928C122A35F89900095445 /* MacWidgetExtension */; + targetProxy = 54928C232A35F89A00095445 /* PBXContainerItemProxy */; + }; + 54928C3D2A35F8B800095445 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 54928C2D2A35F8B800095445 /* PhoneWidgetExtension */; + targetProxy = 54928C3C2A35F8B800095445 /* PBXContainerItemProxy */; + }; + 54928C532A35F8CC00095445 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 54928C452A35F8CB00095445 /* WatchWidgetExtension */; + targetProxy = 54928C522A35F8CC00095445 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ 5431ED7C2A2A77CA00515680 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "JustOneThingWatch Watch App/JustOneThingWatch Watch App.entitlements"; @@ -273,6 +575,7 @@ 5431ED7D2A2A77CA00515680 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "JustOneThingWatch Watch App/JustOneThingWatch Watch App.entitlements"; @@ -493,6 +796,186 @@ }; name = Release; }; + 54928C272A35F89A00095445 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CODE_SIGN_ENTITLEMENTS = MacWidget/MacWidget.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 37UC5MW6PT; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = MacWidget/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = MacWidget; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 13.3; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.alancfrancis.apps.JustOneThing.MacWidget; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 54928C282A35F89A00095445 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CODE_SIGN_ENTITLEMENTS = MacWidget/MacWidget.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 37UC5MW6PT; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = MacWidget/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = MacWidget; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 13.3; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.alancfrancis.apps.JustOneThing.MacWidget; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 54928C402A35F8B800095445 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 37UC5MW6PT; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = PhoneWidget/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = PhoneWidget; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.alancfrancis.apps.JustOneThing.PhoneWidget; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 54928C412A35F8B800095445 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 37UC5MW6PT; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = PhoneWidget/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = PhoneWidget; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.alancfrancis.apps.JustOneThing.PhoneWidget; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 54928C562A35F8CC00095445 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 37UC5MW6PT; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = WatchWidget/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = WatchWidget; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.alancfrancis.apps.JustOneThing.watchkitapp.WatchWidget; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 9.4; + }; + name = Debug; + }; + 54928C572A35F8CC00095445 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 37UC5MW6PT; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = WatchWidget/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = WatchWidget; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.alancfrancis.apps.JustOneThing.watchkitapp.WatchWidget; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + VALIDATE_PRODUCT = YES; + WATCHOS_DEPLOYMENT_TARGET = 9.4; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -523,6 +1006,33 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 54928C292A35F89A00095445 /* Build configuration list for PBXNativeTarget "MacWidgetExtension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 54928C272A35F89A00095445 /* Debug */, + 54928C282A35F89A00095445 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 54928C3F2A35F8B800095445 /* Build configuration list for PBXNativeTarget "PhoneWidgetExtension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 54928C402A35F8B800095445 /* Debug */, + 54928C412A35F8B800095445 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 54928C552A35F8CC00095445 /* Build configuration list for PBXNativeTarget "WatchWidgetExtension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 54928C562A35F8CC00095445 /* Debug */, + 54928C572A35F8CC00095445 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 5483902F2A2A773900BF5624 /* Project object */; diff --git a/JustOneThing.xcodeproj/xcuserdata/acf.xcuserdatad/xcschemes/xcschememanagement.plist b/JustOneThing.xcodeproj/xcuserdata/acf.xcuserdatad/xcschemes/xcschememanagement.plist index 4cdb56e..adfa5ea 100644 --- a/JustOneThing.xcodeproj/xcuserdata/acf.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/JustOneThing.xcodeproj/xcuserdata/acf.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,12 +7,27 @@ JustOneThing.xcscheme_^#shared#^_ orderHint - 1 + 0 JustOneThingWatch Watch App.xcscheme_^#shared#^_ orderHint - 0 + 1 + + MacWidgetExtension.xcscheme_^#shared#^_ + + orderHint + 2 + + PhoneWidgetExtension.xcscheme_^#shared#^_ + + orderHint + 3 + + WatchWidgetExtension.xcscheme_^#shared#^_ + + orderHint + 4 diff --git a/MacWidget/Assets.xcassets/AccentColor.colorset/Contents.json b/MacWidget/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/MacWidget/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MacWidget/Assets.xcassets/AppIcon.appiconset/Contents.json b/MacWidget/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..3f00db4 --- /dev/null +++ b/MacWidget/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MacWidget/Assets.xcassets/Contents.json b/MacWidget/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/MacWidget/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MacWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json b/MacWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/MacWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MacWidget/Info.plist b/MacWidget/Info.plist new file mode 100644 index 0000000..0f118fb --- /dev/null +++ b/MacWidget/Info.plist @@ -0,0 +1,11 @@ + + + + + NSExtension + + NSExtensionPointIdentifier + com.apple.widgetkit-extension + + + diff --git a/MacWidget/MacWidget.entitlements b/MacWidget/MacWidget.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/MacWidget/MacWidget.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/MacWidget/MacWidget.intentdefinition b/MacWidget/MacWidget.intentdefinition new file mode 100644 index 0000000..bdb4045 --- /dev/null +++ b/MacWidget/MacWidget.intentdefinition @@ -0,0 +1,59 @@ + + + + + INEnums + + INIntentDefinitionModelVersion + 1.2 + INIntentDefinitionNamespace + 88xZPY + INIntentDefinitionSystemVersion + 20A294 + INIntentDefinitionToolsBuildVersion + 12A6144 + INIntentDefinitionToolsVersion + 12.0 + INIntents + + + INIntentCategory + information + INIntentDescriptionID + tVvJ9c + INIntentEligibleForWidgets + + INIntentIneligibleForSuggestions + + INIntentName + Configuration + INIntentResponse + + INIntentResponseCodes + + + INIntentResponseCodeName + success + INIntentResponseCodeSuccess + + + + INIntentResponseCodeName + failure + + + + INIntentTitle + Configuration + INIntentTitleID + gpCwrM + INIntentType + Custom + INIntentVerb + View + + + INTypes + + + diff --git a/MacWidget/MacWidget.swift b/MacWidget/MacWidget.swift new file mode 100644 index 0000000..969134b --- /dev/null +++ b/MacWidget/MacWidget.swift @@ -0,0 +1,69 @@ +// +// MacWidget.swift +// MacWidget +// +// Created by Alan Francis on 11/06/2023. +// + +import WidgetKit +import SwiftUI +import Intents + +struct Provider: IntentTimelineProvider { + func placeholder(in context: Context) -> SimpleEntry { + SimpleEntry(date: Date(), configuration: ConfigurationIntent()) + } + + func getSnapshot(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (SimpleEntry) -> ()) { + let entry = SimpleEntry(date: Date(), configuration: configuration) + completion(entry) + } + + func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline) -> ()) { + var entries: [SimpleEntry] = [] + + // Generate a timeline consisting of five entries an hour apart, starting from the current date. + let currentDate = Date() + for hourOffset in 0 ..< 5 { + let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)! + let entry = SimpleEntry(date: entryDate, configuration: configuration) + entries.append(entry) + } + + let timeline = Timeline(entries: entries, policy: .atEnd) + completion(timeline) + } +} + +struct SimpleEntry: TimelineEntry { + let date: Date + let configuration: ConfigurationIntent +} + +struct MacWidgetEntryView : View { + var entry: Provider.Entry + + var body: some View { + Text(entry.date, style: .time) + } +} + +@main +struct MacWidget: Widget { + let kind: String = "MacWidget" + + var body: some WidgetConfiguration { + IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider()) { entry in + MacWidgetEntryView(entry: entry) + } + .configurationDisplayName("My Widget") + .description("This is an example widget.") + } +} + +struct MacWidget_Previews: PreviewProvider { + static var previews: some View { + MacWidgetEntryView(entry: SimpleEntry(date: Date(), configuration: ConfigurationIntent())) + .previewContext(WidgetPreviewContext(family: .systemSmall)) + } +} diff --git a/PhoneWidget/Assets.xcassets/AccentColor.colorset/Contents.json b/PhoneWidget/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/PhoneWidget/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PhoneWidget/Assets.xcassets/AppIcon.appiconset/Contents.json b/PhoneWidget/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..13613e3 --- /dev/null +++ b/PhoneWidget/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PhoneWidget/Assets.xcassets/Contents.json b/PhoneWidget/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/PhoneWidget/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PhoneWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json b/PhoneWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/PhoneWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PhoneWidget/Info.plist b/PhoneWidget/Info.plist new file mode 100644 index 0000000..0f118fb --- /dev/null +++ b/PhoneWidget/Info.plist @@ -0,0 +1,11 @@ + + + + + NSExtension + + NSExtensionPointIdentifier + com.apple.widgetkit-extension + + + diff --git a/PhoneWidget/PhoneWidget.intentdefinition b/PhoneWidget/PhoneWidget.intentdefinition new file mode 100644 index 0000000..bdb4045 --- /dev/null +++ b/PhoneWidget/PhoneWidget.intentdefinition @@ -0,0 +1,59 @@ + + + + + INEnums + + INIntentDefinitionModelVersion + 1.2 + INIntentDefinitionNamespace + 88xZPY + INIntentDefinitionSystemVersion + 20A294 + INIntentDefinitionToolsBuildVersion + 12A6144 + INIntentDefinitionToolsVersion + 12.0 + INIntents + + + INIntentCategory + information + INIntentDescriptionID + tVvJ9c + INIntentEligibleForWidgets + + INIntentIneligibleForSuggestions + + INIntentName + Configuration + INIntentResponse + + INIntentResponseCodes + + + INIntentResponseCodeName + success + INIntentResponseCodeSuccess + + + + INIntentResponseCodeName + failure + + + + INIntentTitle + Configuration + INIntentTitleID + gpCwrM + INIntentType + Custom + INIntentVerb + View + + + INTypes + + + diff --git a/PhoneWidget/PhoneWidget.swift b/PhoneWidget/PhoneWidget.swift new file mode 100644 index 0000000..0cea054 --- /dev/null +++ b/PhoneWidget/PhoneWidget.swift @@ -0,0 +1,68 @@ +// +// PhoneWidget.swift +// PhoneWidget +// +// Created by Alan Francis on 11/06/2023. +// + +import WidgetKit +import SwiftUI +import Intents + +struct Provider: IntentTimelineProvider { + func placeholder(in context: Context) -> SimpleEntry { + SimpleEntry(date: Date(), configuration: ConfigurationIntent()) + } + + func getSnapshot(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (SimpleEntry) -> ()) { + let entry = SimpleEntry(date: Date(), configuration: configuration) + completion(entry) + } + + func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline) -> ()) { + var entries: [SimpleEntry] = [] + + // Generate a timeline consisting of five entries an hour apart, starting from the current date. + let currentDate = Date() + for hourOffset in 0 ..< 5 { + let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)! + let entry = SimpleEntry(date: entryDate, configuration: configuration) + entries.append(entry) + } + + let timeline = Timeline(entries: entries, policy: .atEnd) + completion(timeline) + } +} + +struct SimpleEntry: TimelineEntry { + let date: Date + let configuration: ConfigurationIntent +} + +struct PhoneWidgetEntryView : View { + var entry: Provider.Entry + + var body: some View { + Text(entry.date, style: .time) + } +} + +struct PhoneWidget: Widget { + let kind: String = "PhoneWidget" + + var body: some WidgetConfiguration { + IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider()) { entry in + PhoneWidgetEntryView(entry: entry) + } + .configurationDisplayName("My Widget") + .description("This is an example widget.") + } +} + +struct PhoneWidget_Previews: PreviewProvider { + static var previews: some View { + PhoneWidgetEntryView(entry: SimpleEntry(date: Date(), configuration: ConfigurationIntent())) + .previewContext(WidgetPreviewContext(family: .systemSmall)) + } +} diff --git a/PhoneWidget/PhoneWidgetBundle.swift b/PhoneWidget/PhoneWidgetBundle.swift new file mode 100644 index 0000000..6c0d041 --- /dev/null +++ b/PhoneWidget/PhoneWidgetBundle.swift @@ -0,0 +1,16 @@ +// +// PhoneWidgetBundle.swift +// PhoneWidget +// +// Created by Alan Francis on 11/06/2023. +// + +import WidgetKit +import SwiftUI + +@main +struct PhoneWidgetBundle: WidgetBundle { + var body: some Widget { + PhoneWidget() + } +} diff --git a/WatchWidget/Assets.xcassets/AccentColor.colorset/Contents.json b/WatchWidget/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/WatchWidget/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WatchWidget/Assets.xcassets/AppIcon.appiconset/Contents.json b/WatchWidget/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..49c81cd --- /dev/null +++ b/WatchWidget/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "watchos", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WatchWidget/Assets.xcassets/Contents.json b/WatchWidget/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/WatchWidget/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WatchWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json b/WatchWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/WatchWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WatchWidget/Info.plist b/WatchWidget/Info.plist new file mode 100644 index 0000000..0f118fb --- /dev/null +++ b/WatchWidget/Info.plist @@ -0,0 +1,11 @@ + + + + + NSExtension + + NSExtensionPointIdentifier + com.apple.widgetkit-extension + + + diff --git a/WatchWidget/WatchWidget.intentdefinition b/WatchWidget/WatchWidget.intentdefinition new file mode 100644 index 0000000..bdb4045 --- /dev/null +++ b/WatchWidget/WatchWidget.intentdefinition @@ -0,0 +1,59 @@ + + + + + INEnums + + INIntentDefinitionModelVersion + 1.2 + INIntentDefinitionNamespace + 88xZPY + INIntentDefinitionSystemVersion + 20A294 + INIntentDefinitionToolsBuildVersion + 12A6144 + INIntentDefinitionToolsVersion + 12.0 + INIntents + + + INIntentCategory + information + INIntentDescriptionID + tVvJ9c + INIntentEligibleForWidgets + + INIntentIneligibleForSuggestions + + INIntentName + Configuration + INIntentResponse + + INIntentResponseCodes + + + INIntentResponseCodeName + success + INIntentResponseCodeSuccess + + + + INIntentResponseCodeName + failure + + + + INIntentTitle + Configuration + INIntentTitleID + gpCwrM + INIntentType + Custom + INIntentVerb + View + + + INTypes + + + diff --git a/WatchWidget/WatchWidget.swift b/WatchWidget/WatchWidget.swift new file mode 100644 index 0000000..1b54594 --- /dev/null +++ b/WatchWidget/WatchWidget.swift @@ -0,0 +1,75 @@ +// +// WatchWidget.swift +// WatchWidget +// +// Created by Alan Francis on 11/06/2023. +// + +import WidgetKit +import SwiftUI +import Intents + +struct Provider: IntentTimelineProvider { + func placeholder(in context: Context) -> SimpleEntry { + SimpleEntry(date: Date(), configuration: ConfigurationIntent()) + } + + func getSnapshot(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (SimpleEntry) -> ()) { + let entry = SimpleEntry(date: Date(), configuration: configuration) + completion(entry) + } + + func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline) -> ()) { + var entries: [SimpleEntry] = [] + + // Generate a timeline consisting of five entries an hour apart, starting from the current date. + let currentDate = Date() + for hourOffset in 0 ..< 5 { + let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)! + let entry = SimpleEntry(date: entryDate, configuration: configuration) + entries.append(entry) + } + + let timeline = Timeline(entries: entries, policy: .atEnd) + completion(timeline) + } + + func recommendations() -> [IntentRecommendation] { + return [ + IntentRecommendation(intent: ConfigurationIntent(), description: "My Intent Widget") + ] + } +} + +struct SimpleEntry: TimelineEntry { + let date: Date + let configuration: ConfigurationIntent +} + +struct WatchWidgetEntryView : View { + var entry: Provider.Entry + + var body: some View { + Text(entry.date, style: .time) + } +} + +@main +struct WatchWidget: Widget { + let kind: String = "WatchWidget" + + var body: some WidgetConfiguration { + IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider()) { entry in + WatchWidgetEntryView(entry: entry) + } + .configurationDisplayName("My Widget") + .description("This is an example widget.") + } +} + +struct WatchWidget_Previews: PreviewProvider { + static var previews: some View { + WatchWidgetEntryView(entry: SimpleEntry(date: Date(), configuration: ConfigurationIntent())) + .previewContext(WidgetPreviewContext(family: .accessoryRectangular)) + } +}