diff --git a/StepMap.xcodeproj/project.pbxproj b/StepMap.xcodeproj/project.pbxproj index 7774846..02624ae 100644 --- a/StepMap.xcodeproj/project.pbxproj +++ b/StepMap.xcodeproj/project.pbxproj @@ -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 = ""; }; + 6C6E6C392D009628003D3BA9 /* StepMapWidgets */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 6C6E6C472D00962A003D3BA9 /* Exceptions for "StepMapWidgets" folder in "StepMapWidgetsExtension" target */, + ); + path = StepMapWidgets; + sourceTree = ""; + }; /* 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 = ""; @@ -41,10 +103,20 @@ isa = PBXGroup; children = ( 6C5D06452CF209960006CDE9 /* StepMap.app */, + 6C6E6C332D009628003D3BA9 /* StepMapWidgetsExtension.appex */, ); name = Products; sourceTree = ""; }; + 6C6E6C342D009628003D3BA9 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6C6E6C352D009628003D3BA9 /* WidgetKit.framework */, + 6C6E6C372D009628003D3BA9 /* SwiftUI.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* 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 */; diff --git a/StepMap.xcodeproj/xcuserdata/oliverhnat.xcuserdatad/xcschemes/xcschememanagement.plist b/StepMap.xcodeproj/xcuserdata/oliverhnat.xcuserdatad/xcschemes/xcschememanagement.plist index 18529fc..acfd2dd 100644 --- a/StepMap.xcodeproj/xcuserdata/oliverhnat.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/StepMap.xcodeproj/xcuserdata/oliverhnat.xcuserdatad/xcschemes/xcschememanagement.plist @@ -9,6 +9,11 @@ orderHint 0 + StepMapWidgetsExtension.xcscheme_^#shared#^_ + + orderHint + 1 + diff --git a/StepMapWidgets/Assets.xcassets/AccentColor.colorset/Contents.json b/StepMapWidgets/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/StepMapWidgets/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/StepMapWidgets/Assets.xcassets/AppIcon.appiconset/Contents.json b/StepMapWidgets/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2305880 --- /dev/null +++ b/StepMapWidgets/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -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 + } +} diff --git a/StepMapWidgets/Assets.xcassets/Contents.json b/StepMapWidgets/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/StepMapWidgets/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/StepMapWidgets/Assets.xcassets/WidgetBackground.colorset/Contents.json b/StepMapWidgets/Assets.xcassets/WidgetBackground.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/StepMapWidgets/Assets.xcassets/WidgetBackground.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/StepMapWidgets/Info.plist b/StepMapWidgets/Info.plist new file mode 100644 index 0000000..0f118fb --- /dev/null +++ b/StepMapWidgets/Info.plist @@ -0,0 +1,11 @@ + + + + + NSExtension + + NSExtensionPointIdentifier + com.apple.widgetkit-extension + + + diff --git a/StepMapWidgets/StepMapWidgets.swift b/StepMapWidgets/StepMapWidgets.swift new file mode 100644 index 0000000..ffa137e --- /dev/null +++ b/StepMapWidgets/StepMapWidgets.swift @@ -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) -> ()) { + 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 { +// // 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: "๐Ÿคฉ") +} diff --git a/StepMapWidgets/StepMapWidgetsBundle.swift b/StepMapWidgets/StepMapWidgetsBundle.swift new file mode 100644 index 0000000..dc69f95 --- /dev/null +++ b/StepMapWidgets/StepMapWidgetsBundle.swift @@ -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() + } +}