feat(widget): add initial widget target
This commit is contained in:
@@ -6,16 +6,67 @@
|
||||
objectVersion = 77;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
6C6E6C362D009628003D3BA9 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C6E6C352D009628003D3BA9 /* WidgetKit.framework */; };
|
||||
6C6E6C382D009628003D3BA9 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C6E6C372D009628003D3BA9 /* SwiftUI.framework */; };
|
||||
6C6E6C432D00962A003D3BA9 /* StepMapWidgetsExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 6C6E6C332D009628003D3BA9 /* StepMapWidgetsExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
6C6E6C412D00962A003D3BA9 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 6C5D063D2CF209960006CDE9 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 6C6E6C322D009628003D3BA9;
|
||||
remoteInfo = StepMapWidgetsExtension;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
6C6E6C442D00962A003D3BA9 /* Embed Foundation Extensions */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 13;
|
||||
files = (
|
||||
6C6E6C432D00962A003D3BA9 /* StepMapWidgetsExtension.appex in Embed Foundation Extensions */,
|
||||
);
|
||||
name = "Embed Foundation Extensions";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
6C5D06452CF209960006CDE9 /* StepMap.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StepMap.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6C6E6C332D009628003D3BA9 /* StepMapWidgetsExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = StepMapWidgetsExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6C6E6C352D009628003D3BA9 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
|
||||
6C6E6C372D009628003D3BA9 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||
6C6E6C472D00962A003D3BA9 /* Exceptions for "StepMapWidgets" folder in "StepMapWidgetsExtension" target */ = {
|
||||
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
||||
membershipExceptions = (
|
||||
Info.plist,
|
||||
);
|
||||
target = 6C6E6C322D009628003D3BA9 /* StepMapWidgetsExtension */;
|
||||
};
|
||||
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||
6C5D06472CF209960006CDE9 /* StepMap */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = StepMap;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6C6E6C392D009628003D3BA9 /* StepMapWidgets */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
exceptions = (
|
||||
6C6E6C472D00962A003D3BA9 /* Exceptions for "StepMapWidgets" folder in "StepMapWidgetsExtension" target */,
|
||||
);
|
||||
path = StepMapWidgets;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -26,6 +77,15 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6C6E6C302D009628003D3BA9 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6C6E6C382D009628003D3BA9 /* SwiftUI.framework in Frameworks */,
|
||||
6C6E6C362D009628003D3BA9 /* WidgetKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@@ -33,6 +93,8 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6C5D06472CF209960006CDE9 /* StepMap */,
|
||||
6C6E6C392D009628003D3BA9 /* StepMapWidgets */,
|
||||
6C6E6C342D009628003D3BA9 /* Frameworks */,
|
||||
6C5D06462CF209960006CDE9 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
@@ -41,10 +103,20 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6C5D06452CF209960006CDE9 /* StepMap.app */,
|
||||
6C6E6C332D009628003D3BA9 /* StepMapWidgetsExtension.appex */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6C6E6C342D009628003D3BA9 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6C6E6C352D009628003D3BA9 /* WidgetKit.framework */,
|
||||
6C6E6C372D009628003D3BA9 /* SwiftUI.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -55,10 +127,12 @@
|
||||
6C5D06412CF209960006CDE9 /* Sources */,
|
||||
6C5D06422CF209960006CDE9 /* Frameworks */,
|
||||
6C5D06432CF209960006CDE9 /* Resources */,
|
||||
6C6E6C442D00962A003D3BA9 /* Embed Foundation Extensions */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
6C6E6C422D00962A003D3BA9 /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
6C5D06472CF209960006CDE9 /* StepMap */,
|
||||
@@ -70,6 +144,28 @@
|
||||
productReference = 6C5D06452CF209960006CDE9 /* StepMap.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
6C6E6C322D009628003D3BA9 /* StepMapWidgetsExtension */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 6C6E6C482D00962A003D3BA9 /* Build configuration list for PBXNativeTarget "StepMapWidgetsExtension" */;
|
||||
buildPhases = (
|
||||
6C6E6C2F2D009628003D3BA9 /* Sources */,
|
||||
6C6E6C302D009628003D3BA9 /* Frameworks */,
|
||||
6C6E6C312D009628003D3BA9 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
6C6E6C392D009628003D3BA9 /* StepMapWidgets */,
|
||||
);
|
||||
name = StepMapWidgetsExtension;
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = StepMapWidgetsExtension;
|
||||
productReference = 6C6E6C332D009628003D3BA9 /* StepMapWidgetsExtension.appex */;
|
||||
productType = "com.apple.product-type.app-extension";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
@@ -83,6 +179,9 @@
|
||||
6C5D06442CF209960006CDE9 = {
|
||||
CreatedOnToolsVersion = 16.1;
|
||||
};
|
||||
6C6E6C322D009628003D3BA9 = {
|
||||
CreatedOnToolsVersion = 16.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 6C5D06402CF209960006CDE9 /* Build configuration list for PBXProject "StepMap" */;
|
||||
@@ -100,6 +199,7 @@
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
6C5D06442CF209960006CDE9 /* StepMap */,
|
||||
6C6E6C322D009628003D3BA9 /* StepMapWidgetsExtension */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -112,6 +212,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6C6E6C312D009628003D3BA9 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@@ -122,8 +229,23 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6C6E6C2F2D009628003D3BA9 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
6C6E6C422D00962A003D3BA9 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 6C6E6C322D009628003D3BA9 /* StepMapWidgetsExtension */;
|
||||
targetProxy = 6C6E6C412D00962A003D3BA9 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
6C5D06562CF209970006CDE9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
@@ -310,6 +432,60 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
6C6E6C452D00962A003D3BA9 /* 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 = SSJBLTMP95;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = StepMapWidgets/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = StepMapWidgets;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = oliverhnat.StepMap.StepMapWidgets;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
6C6E6C462D00962A003D3BA9 /* 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 = SSJBLTMP95;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = StepMapWidgets/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = StepMapWidgets;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = oliverhnat.StepMap.StepMapWidgets;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@@ -331,6 +507,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
6C6E6C482D00962A003D3BA9 /* Build configuration list for PBXNativeTarget "StepMapWidgetsExtension" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
6C6E6C452D00962A003D3BA9 /* Debug */,
|
||||
6C6E6C462D00962A003D3BA9 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 6C5D063D2CF209960006CDE9 /* Project object */;
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>StepMapWidgetsExtension.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "tinted"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
6
StepMapWidgets/Assets.xcassets/Contents.json
Normal file
6
StepMapWidgets/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
11
StepMapWidgets/Info.plist
Normal file
11
StepMapWidgets/Info.plist
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.widgetkit-extension</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
84
StepMapWidgets/StepMapWidgets.swift
Normal file
84
StepMapWidgets/StepMapWidgets.swift
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// StepMapWidgets.swift
|
||||
// StepMapWidgets
|
||||
//
|
||||
// Created by Oliver Hnát on 04.12.2024.
|
||||
//
|
||||
|
||||
import WidgetKit
|
||||
import SwiftUI
|
||||
|
||||
struct Provider: TimelineProvider {
|
||||
func placeholder(in context: Context) -> SimpleEntry {
|
||||
SimpleEntry(date: Date(), emoji: "😀")
|
||||
}
|
||||
|
||||
func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) {
|
||||
let entry = SimpleEntry(date: Date(), emoji: "😀")
|
||||
completion(entry)
|
||||
}
|
||||
|
||||
func getTimeline(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, emoji: "😀")
|
||||
entries.append(entry)
|
||||
}
|
||||
|
||||
let timeline = Timeline(entries: entries, policy: .atEnd)
|
||||
completion(timeline)
|
||||
}
|
||||
|
||||
// func relevances() async -> WidgetRelevances<Void> {
|
||||
// // Generate a list containing the contexts this widget is relevant in.
|
||||
// }
|
||||
}
|
||||
|
||||
struct SimpleEntry: TimelineEntry {
|
||||
let date: Date
|
||||
let emoji: String
|
||||
}
|
||||
|
||||
struct StepMapWidgetsEntryView : View {
|
||||
var entry: Provider.Entry
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text("Time:")
|
||||
Text(entry.date, style: .time)
|
||||
|
||||
Text("Emoji:")
|
||||
Text(entry.emoji)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct StepMapWidgets: Widget {
|
||||
let kind: String = "StepMapWidgets"
|
||||
|
||||
var body: some WidgetConfiguration {
|
||||
StaticConfiguration(kind: kind, provider: Provider()) { entry in
|
||||
if #available(iOS 17.0, *) {
|
||||
StepMapWidgetsEntryView(entry: entry)
|
||||
.containerBackground(.fill.tertiary, for: .widget)
|
||||
} else {
|
||||
StepMapWidgetsEntryView(entry: entry)
|
||||
.padding()
|
||||
.background()
|
||||
}
|
||||
}
|
||||
.configurationDisplayName("My Widget")
|
||||
.description("This is an example widget.")
|
||||
}
|
||||
}
|
||||
|
||||
#Preview(as: .systemSmall) {
|
||||
StepMapWidgets()
|
||||
} timeline: {
|
||||
SimpleEntry(date: .now, emoji: "😀")
|
||||
SimpleEntry(date: .now, emoji: "🤩")
|
||||
}
|
||||
16
StepMapWidgets/StepMapWidgetsBundle.swift
Normal file
16
StepMapWidgets/StepMapWidgetsBundle.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// StepMapWidgetsBundle.swift
|
||||
// StepMapWidgets
|
||||
//
|
||||
// Created by Oliver Hnát on 04.12.2024.
|
||||
//
|
||||
|
||||
import WidgetKit
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct StepMapWidgetsBundle: WidgetBundle {
|
||||
var body: some Widget {
|
||||
StepMapWidgets()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user