End of Step 11: Tidy Up

xcode15-and-vision
Alan Francis 2 years ago
parent 42580684c1
commit 1dd9520257
  1. 46
      JustOneThing.xcodeproj/project.pbxproj
  2. 12
      JustOneThing.xcodeproj/xcshareddata/xcschemes/JustOneThingWatch.xcscheme
  3. 15
      JustOneThing.xcodeproj/xcshareddata/xcschemes/WatchWidgetExtension.xcscheme
  4. 2
      JustOneThing.xcodeproj/xcuserdata/acf.xcuserdatad/xcschemes/xcschememanagement.plist
  5. 0
      JustOneThingWatch/JustOneThingWatch.entitlements
  6. 47
      WidgetShared/JustOneThingProvider.swift
  7. 48
      WidgetShared/JustOneThingWidget.swift

@ -10,7 +10,7 @@
5407E5022A2A8AE200EF00B8 /* JustOneThingApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5483903A2A2A773900BF5624 /* JustOneThingApp.swift */; };
5407E5032A2A8AE700EF00B8 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5483903C2A2A773900BF5624 /* ContentView.swift */; };
5407E5042A2A8AEA00EF00B8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5483903E2A2A773A00BF5624 /* Assets.xcassets */; };
5431ED7A2A2A77CA00515680 /* JustOneThingWatch Watch App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 5431ED6D2A2A77C900515680 /* JustOneThingWatch Watch App.app */; platformFilter = ios; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
5431ED7A2A2A77CA00515680 /* JustOneThingWatch.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 5431ED6D2A2A77C900515680 /* JustOneThingWatch.app */; platformFilter = ios; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
5472018C2A36563A005B2FCC /* WidgetAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 54928C372A35F8B800095445 /* WidgetAssets.xcassets */; };
5472018E2A36563B005B2FCC /* Widget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 54928C1C2A35F89900095445 /* Widget.intentdefinition */; };
547201902A36563C005B2FCC /* Widget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 54928C1C2A35F89900095445 /* Widget.intentdefinition */; };
@ -34,6 +34,9 @@
54928C482A35F8CB00095445 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54928C172A35F89900095445 /* SwiftUI.framework */; };
54928C4B2A35F8CB00095445 /* JustOneThingWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54928C4A2A35F8CB00095445 /* JustOneThingWidget.swift */; };
54928C542A35F8CC00095445 /* WatchWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 54928C462A35F8CB00095445 /* WatchWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
5493A81B2A471E37001EBA08 /* JustOneThingProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5493A81A2A471E36001EBA08 /* JustOneThingProvider.swift */; };
5493A81C2A471E37001EBA08 /* JustOneThingProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5493A81A2A471E36001EBA08 /* JustOneThingProvider.swift */; };
5493A81D2A471E37001EBA08 /* JustOneThingProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5493A81A2A471E36001EBA08 /* JustOneThingProvider.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -74,7 +77,7 @@
dstPath = "$(CONTENTS_FOLDER_PATH)/Watch";
dstSubfolderSpec = 16;
files = (
5431ED7A2A2A77CA00515680 /* JustOneThingWatch Watch App.app in Embed Watch Content */,
5431ED7A2A2A77CA00515680 /* JustOneThingWatch.app in Embed Watch Content */,
);
name = "Embed Watch Content";
runOnlyForDeploymentPostprocessing = 0;
@ -105,8 +108,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
5407E5062A35B96E00EF00B8 /* JustOneThingWatch Watch App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "JustOneThingWatch Watch App.entitlements"; sourceTree = "<group>"; };
5431ED6D2A2A77C900515680 /* JustOneThingWatch Watch App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "JustOneThingWatch Watch App.app"; sourceTree = BUILT_PRODUCTS_DIR; };
5407E5062A35B96E00EF00B8 /* JustOneThingWatch.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = JustOneThingWatch.entitlements; sourceTree = "<group>"; };
5431ED6D2A2A77C900515680 /* JustOneThingWatch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JustOneThingWatch.app; sourceTree = BUILT_PRODUCTS_DIR; };
547201942A461554005B2FCC /* PhoneWidget.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PhoneWidget.entitlements; sourceTree = "<group>"; };
547201952A461558005B2FCC /* WatchWidget.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WatchWidget.entitlements; sourceTree = "<group>"; };
548390372A2A773900BF5624 /* JustOneThing.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JustOneThing.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -124,6 +127,7 @@
54928C392A35F8B800095445 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
54928C462A35F8CB00095445 /* WatchWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = WatchWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
54928C4A2A35F8CB00095445 /* JustOneThingWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JustOneThingWidget.swift; sourceTree = "<group>"; };
5493A81A2A471E36001EBA08 /* JustOneThingProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JustOneThingProvider.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -181,21 +185,22 @@
path = AppShared;
sourceTree = "<group>";
};
5431ED6E2A2A77C900515680 /* JustOneThingWatch Watch App */ = {
5431ED6E2A2A77C900515680 /* JustOneThingWatch */ = {
isa = PBXGroup;
children = (
5407E5062A35B96E00EF00B8 /* JustOneThingWatch Watch App.entitlements */,
5407E5062A35B96E00EF00B8 /* JustOneThingWatch.entitlements */,
);
path = "JustOneThingWatch Watch App";
path = JustOneThingWatch;
sourceTree = "<group>";
};
5472018B2A3655E4005B2FCC /* WidgetShared */ = {
isa = PBXGroup;
children = (
54928C4A2A35F8CB00095445 /* JustOneThingWidget.swift */,
5493A81A2A471E36001EBA08 /* JustOneThingProvider.swift */,
54928C372A35F8B800095445 /* WidgetAssets.xcassets */,
54928C392A35F8B800095445 /* Info.plist */,
54928C1C2A35F89900095445 /* Widget.intentdefinition */,
54928C4A2A35F8CB00095445 /* JustOneThingWidget.swift */,
);
path = WidgetShared;
sourceTree = "<group>";
@ -205,7 +210,7 @@
children = (
5407E5012A2A8A5100EF00B8 /* AppShared */,
548390392A2A773900BF5624 /* JustOneThing */,
5431ED6E2A2A77C900515680 /* JustOneThingWatch Watch App */,
5431ED6E2A2A77C900515680 /* JustOneThingWatch */,
5472018B2A3655E4005B2FCC /* WidgetShared */,
54928C192A35F89900095445 /* MacWidget */,
54928C312A35F8B800095445 /* PhoneWidget */,
@ -219,7 +224,7 @@
isa = PBXGroup;
children = (
548390372A2A773900BF5624 /* JustOneThing.app */,
5431ED6D2A2A77C900515680 /* JustOneThingWatch Watch App.app */,
5431ED6D2A2A77C900515680 /* JustOneThingWatch.app */,
54928C132A35F89900095445 /* MacWidgetExtension.appex */,
54928C2E2A35F8B800095445 /* PhoneWidgetExtension.appex */,
54928C462A35F8CB00095445 /* WatchWidgetExtension.appex */,
@ -271,9 +276,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
5431ED6C2A2A77C900515680 /* JustOneThingWatch Watch App */ = {
5431ED6C2A2A77C900515680 /* JustOneThingWatch */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5431ED7E2A2A77CA00515680 /* Build configuration list for PBXNativeTarget "JustOneThingWatch Watch App" */;
buildConfigurationList = 5431ED7E2A2A77CA00515680 /* Build configuration list for PBXNativeTarget "JustOneThingWatch" */;
buildPhases = (
5431ED692A2A77C900515680 /* Sources */,
5431ED6A2A2A77C900515680 /* Frameworks */,
@ -285,9 +290,9 @@
dependencies = (
54928C532A35F8CC00095445 /* PBXTargetDependency */,
);
name = "JustOneThingWatch Watch App";
name = JustOneThingWatch;
productName = "JustOneThingWatch Watch App";
productReference = 5431ED6D2A2A77C900515680 /* JustOneThingWatch Watch App.app */;
productReference = 5431ED6D2A2A77C900515680 /* JustOneThingWatch.app */;
productType = "com.apple.product-type.application";
};
548390362A2A773900BF5624 /* JustOneThing */ = {
@ -404,7 +409,7 @@
projectRoot = "";
targets = (
548390362A2A773900BF5624 /* JustOneThing */,
5431ED6C2A2A77C900515680 /* JustOneThingWatch Watch App */,
5431ED6C2A2A77C900515680 /* JustOneThingWatch */,
54928C122A35F89900095445 /* MacWidgetExtension */,
54928C2D2A35F8B800095445 /* PhoneWidgetExtension */,
54928C452A35F8CB00095445 /* WatchWidgetExtension */,
@ -481,6 +486,7 @@
buildActionMask = 2147483647;
files = (
54928C212A35F89A00095445 /* Widget.intentdefinition in Sources */,
5493A81B2A471E37001EBA08 /* JustOneThingProvider.swift in Sources */,
547201972A461DBE005B2FCC /* JustOneThingWidget.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -490,6 +496,7 @@
buildActionMask = 2147483647;
files = (
547201962A461DBE005B2FCC /* JustOneThingWidget.swift in Sources */,
5493A81C2A471E37001EBA08 /* JustOneThingProvider.swift in Sources */,
5472018E2A36563B005B2FCC /* Widget.intentdefinition in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -499,6 +506,7 @@
buildActionMask = 2147483647;
files = (
547201902A36563C005B2FCC /* Widget.intentdefinition in Sources */,
5493A81D2A471E37001EBA08 /* JustOneThingProvider.swift in Sources */,
54928C4B2A35F8CB00095445 /* JustOneThingWidget.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -509,7 +517,7 @@
5431ED792A2A77CA00515680 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
platformFilter = ios;
target = 5431ED6C2A2A77C900515680 /* JustOneThingWatch Watch App */;
target = 5431ED6C2A2A77C900515680 /* JustOneThingWatch */;
targetProxy = 5431ED782A2A77CA00515680 /* PBXContainerItemProxy */;
};
54928C242A35F89A00095445 /* PBXTargetDependency */ = {
@ -540,7 +548,7 @@
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";
CODE_SIGN_ENTITLEMENTS = JustOneThingWatch/JustOneThingWatch.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "";
@ -572,7 +580,7 @@
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";
CODE_SIGN_ENTITLEMENTS = JustOneThingWatch/JustOneThingWatch.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "";
@ -977,7 +985,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5431ED7E2A2A77CA00515680 /* Build configuration list for PBXNativeTarget "JustOneThingWatch Watch App" */ = {
5431ED7E2A2A77CA00515680 /* Build configuration list for PBXNativeTarget "JustOneThingWatch" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5431ED7C2A2A77CA00515680 /* Debug */,

@ -15,8 +15,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5431ED6C2A2A77C900515680"
BuildableName = "JustOneThingWatch Watch App.app"
BlueprintName = "JustOneThingWatch Watch App"
BuildableName = "JustOneThingWatch.app"
BlueprintName = "JustOneThingWatch"
ReferencedContainer = "container:JustOneThing.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@ -58,8 +58,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5431ED6C2A2A77C900515680"
BuildableName = "JustOneThingWatch Watch App.app"
BlueprintName = "JustOneThingWatch Watch App"
BuildableName = "JustOneThingWatch.app"
BlueprintName = "JustOneThingWatch"
ReferencedContainer = "container:JustOneThing.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
@ -75,8 +75,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5431ED6C2A2A77C900515680"
BuildableName = "JustOneThingWatch Watch App.app"
BlueprintName = "JustOneThingWatch Watch App"
BuildableName = "JustOneThingWatch.app"
BlueprintName = "JustOneThingWatch"
ReferencedContainer = "container:JustOneThing.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>

@ -43,8 +43,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5431ED6C2A2A77C900515680"
BuildableName = "JustOneThingWatch Watch App.app"
BlueprintName = "JustOneThingWatch Watch App"
BuildableName = "JustOneThingWatch.app"
BlueprintName = "JustOneThingWatch"
ReferencedContainer = "container:JustOneThing.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@ -71,6 +71,15 @@
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "54928C452A35F8CB00095445"
BuildableName = "WatchWidgetExtension.appex"
BlueprintName = "WatchWidgetExtension"
ReferencedContainer = "container:JustOneThing.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "548390362A2A773900BF5624"
@ -78,7 +87,7 @@
BlueprintName = "JustOneThing"
ReferencedContainer = "container:JustOneThing.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "_XCWidgetKind"

@ -9,7 +9,7 @@
<key>orderHint</key>
<integer>4</integer>
</dict>
<key>JustOneThingWatch Watch App.xcscheme_^#shared#^_</key>
<key>JustOneThingWatch.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>

@ -0,0 +1,47 @@
//
// JustOneThingProvider.swift
// JustOneThing
//
// Created by Alan Francis on 24/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<SimpleEntry>) -> ()) {
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<ConfigurationIntent>] {
return [
IntentRecommendation(intent: ConfigurationIntent(), description: "My Intent Widget")
]
}
}
struct SimpleEntry: TimelineEntry {
let date: Date
let configuration: ConfigurationIntent
}

@ -16,42 +16,6 @@ struct JustOneThingWidgetBundle: WidgetBundle {
}
}
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<Entry>) -> ()) {
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<ConfigurationIntent>] {
return [
IntentRecommendation(intent: ConfigurationIntent(), description: "My Intent Widget")
]
}
}
struct SimpleEntry: TimelineEntry {
let date: Date
let configuration: ConfigurationIntent
}
struct JustOneThingWidgetEntryView : View {
var entry: Provider.Entry
@ -72,3 +36,15 @@ struct JustOneThingWidget: Widget {
.description("This is an example widget.")
}
}
struct Widget_Previews: PreviewProvider {
static var previews: some View {
JustOneThingWidgetEntryView(entry: SimpleEntry(date: Date(), configuration: ConfigurationIntent()))
#if os(watchOS)
.previewContext(WidgetPreviewContext(family: .accessoryRectangular))
#else
.previewContext(WidgetPreviewContext(family: .systemMedium))
#endif
}
}

Loading…
Cancel
Save