Skip to content

Commit ea9bb26

Browse files
authored
feat: add widget extension example (#170)
* feat: add widget extension example * bump xcode version in swift.yml * fix xcode version in swift.yml * bump setup-xcode action to 1.5 * fix xcode version (again) * fix github actions version (again) * try latest stable xcode version * apple updates to examples test Co-authored-by: Alan Charles <[email protected]>
1 parent abcf89d commit ea9bb26

File tree

27 files changed

+1399
-4
lines changed

27 files changed

+1399
-4
lines changed

.github/workflows/swift.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ jobs:
5050
needs: cancel_previous
5151
runs-on: macos-11
5252
steps:
53-
- uses: maxim-lobanov/setup-xcode@v1
53+
- uses: maxim-lobanov/setup-xcode@v1.5.1
5454
with:
55-
xcode-version: '13.2.1'
55+
xcode-version: latest-stable
5656
- uses: actions/checkout@v2
5757
- uses: actions/cache@v2
5858
with:
@@ -108,9 +108,9 @@ jobs:
108108
needs: cancel_previous
109109
runs-on: macos-11
110110
steps:
111-
- uses: maxim-lobanov/setup-xcode@v1
111+
- uses: maxim-lobanov/setup-xcode@v1.5.1
112112
with:
113-
xcode-version: '13.2.1'
113+
xcode-version: latest-stable
114114
- uses: actions/checkout@v2
115115
- uses: actions/cache@v2
116116
with:
@@ -133,6 +133,10 @@ jobs:
133133
run: |
134134
cd Examples/apps/SegmentUIKitExample
135135
xcodebuild -workspace "SegmentUIKitExample.xcworkspace" -scheme "SegmentUIKitExample" -sdk iphonesimulator
136+
- name: build for ios simulator
137+
run: |
138+
cd Examples/apps/SegmentWeatherWidget
139+
xcodebuild -workspace "SegmentWeatherWidget.xcworkspace" -scheme "SegmentWeatherWidget" -sdk iphonesimulator
136140
- name: build for mac catalyst
137141
run: |
138142
cd Examples/apps/SegmentUIKitExample

Examples/apps/SegmentWeatherWidget/SegmentWeatherWidget.xcodeproj/project.pbxproj

Lines changed: 599 additions & 0 deletions
Large diffs are not rendered by default.

Examples/apps/SegmentWeatherWidget/SegmentWeatherWidget.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1400"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "82E374CD2909C8D1002CFC26"
18+
BuildableName = "SegmentWeatherWidget.app"
19+
BlueprintName = "SegmentWeatherWidget"
20+
ReferencedContainer = "container:SegmentWeatherWidget.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "82E374CD2909C8D1002CFC26"
48+
BuildableName = "SegmentWeatherWidget.app"
49+
BlueprintName = "SegmentWeatherWidget"
50+
ReferencedContainer = "container:SegmentWeatherWidget.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "82E374CD2909C8D1002CFC26"
65+
BuildableName = "SegmentWeatherWidget.app"
66+
BlueprintName = "SegmentWeatherWidget"
67+
ReferencedContainer = "container:SegmentWeatherWidget.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1400"
4+
wasCreatedForAppExtension = "YES"
5+
version = "2.0">
6+
<BuildAction
7+
parallelizeBuildables = "YES"
8+
buildImplicitDependencies = "YES">
9+
<BuildActionEntries>
10+
<BuildActionEntry
11+
buildForTesting = "YES"
12+
buildForRunning = "YES"
13+
buildForProfiling = "YES"
14+
buildForArchiving = "YES"
15+
buildForAnalyzing = "YES">
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "82E374E22909C908002CFC26"
19+
BuildableName = "WeatherWidgetExtension.appex"
20+
BlueprintName = "WeatherWidgetExtension"
21+
ReferencedContainer = "container:SegmentWeatherWidget.xcodeproj">
22+
</BuildableReference>
23+
</BuildActionEntry>
24+
<BuildActionEntry
25+
buildForTesting = "YES"
26+
buildForRunning = "YES"
27+
buildForProfiling = "YES"
28+
buildForArchiving = "YES"
29+
buildForAnalyzing = "YES">
30+
<BuildableReference
31+
BuildableIdentifier = "primary"
32+
BlueprintIdentifier = "82E374CD2909C8D1002CFC26"
33+
BuildableName = "SegmentWeatherWidget.app"
34+
BlueprintName = "SegmentWeatherWidget"
35+
ReferencedContainer = "container:SegmentWeatherWidget.xcodeproj">
36+
</BuildableReference>
37+
</BuildActionEntry>
38+
</BuildActionEntries>
39+
</BuildAction>
40+
<TestAction
41+
buildConfiguration = "Debug"
42+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
43+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
44+
shouldUseLaunchSchemeArgsEnv = "YES">
45+
<Testables>
46+
</Testables>
47+
</TestAction>
48+
<LaunchAction
49+
buildConfiguration = "Debug"
50+
selectedDebuggerIdentifier = ""
51+
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
52+
launchStyle = "0"
53+
askForAppToLaunch = "Yes"
54+
useCustomWorkingDirectory = "NO"
55+
ignoresPersistentStateOnLaunch = "NO"
56+
debugDocumentVersioning = "YES"
57+
debugServiceExtension = "internal"
58+
allowLocationSimulation = "YES"
59+
launchAutomaticallySubstyle = "2">
60+
<RemoteRunnable
61+
runnableDebuggingMode = "2"
62+
BundleIdentifier = "com.apple.springboard">
63+
<BuildableReference
64+
BuildableIdentifier = "primary"
65+
BlueprintIdentifier = "82E374E22909C908002CFC26"
66+
BuildableName = "WeatherWidgetExtension.appex"
67+
BlueprintName = "WeatherWidgetExtension"
68+
ReferencedContainer = "container:SegmentWeatherWidget.xcodeproj">
69+
</BuildableReference>
70+
</RemoteRunnable>
71+
<MacroExpansion>
72+
<BuildableReference
73+
BuildableIdentifier = "primary"
74+
BlueprintIdentifier = "82E374CD2909C8D1002CFC26"
75+
BuildableName = "SegmentWeatherWidget.app"
76+
BlueprintName = "SegmentWeatherWidget"
77+
ReferencedContainer = "container:SegmentWeatherWidget.xcodeproj">
78+
</BuildableReference>
79+
</MacroExpansion>
80+
<EnvironmentVariables>
81+
<EnvironmentVariable
82+
key = "_XCWidgetKind"
83+
value = ""
84+
isEnabled = "NO">
85+
</EnvironmentVariable>
86+
<EnvironmentVariable
87+
key = "_XCWidgetDefaultView"
88+
value = "timeline"
89+
isEnabled = "NO">
90+
</EnvironmentVariable>
91+
<EnvironmentVariable
92+
key = "_XCWidgetFamily"
93+
value = "medium"
94+
isEnabled = "NO">
95+
</EnvironmentVariable>
96+
</EnvironmentVariables>
97+
</LaunchAction>
98+
<ProfileAction
99+
buildConfiguration = "Release"
100+
shouldUseLaunchSchemeArgsEnv = "YES"
101+
savedToolIdentifier = ""
102+
useCustomWorkingDirectory = "NO"
103+
debugDocumentVersioning = "YES"
104+
launchAutomaticallySubstyle = "2">
105+
<BuildableProductRunnable
106+
runnableDebuggingMode = "0">
107+
<BuildableReference
108+
BuildableIdentifier = "primary"
109+
BlueprintIdentifier = "82E374CD2909C8D1002CFC26"
110+
BuildableName = "SegmentWeatherWidget.app"
111+
BlueprintName = "SegmentWeatherWidget"
112+
ReferencedContainer = "container:SegmentWeatherWidget.xcodeproj">
113+
</BuildableReference>
114+
</BuildableProductRunnable>
115+
</ProfileAction>
116+
<AnalyzeAction
117+
buildConfiguration = "Debug">
118+
</AnalyzeAction>
119+
<ArchiveAction
120+
buildConfiguration = "Release"
121+
revealArchiveInOrganizer = "YES">
122+
</ArchiveAction>
123+
</Scheme>

Examples/apps/SegmentWeatherWidget/SegmentWeatherWidget.xcworkspace/contents.xcworkspacedata

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"platform" : "ios",
6+
"size" : "1024x1024"
7+
}
8+
],
9+
"info" : {
10+
"author" : "xcode",
11+
"version" : 1
12+
}
13+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// ContentView.swift
3+
// SegmentWeatherWidget
4+
//
5+
// Created by Alan Charles on 10/26/22.
6+
//
7+
8+
import SwiftUI
9+
10+
struct ContentView: View {
11+
var body: some View {
12+
VStack {
13+
Image(systemName: "globe")
14+
.imageScale(.large)
15+
.foregroundColor(.accentColor)
16+
Text("Hello, world!")
17+
}
18+
.padding()
19+
}
20+
}
21+
22+
struct ContentView_Previews: PreviewProvider {
23+
static var previews: some View {
24+
ContentView()
25+
}
26+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>NSUserActivityTypes</key>
6+
<array>
7+
<string>ConfigurationIntent</string>
8+
</array>
9+
</dict>
10+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// SegmentWeatherWidgetApp.swift
3+
// SegmentWeatherWidget
4+
//
5+
// Created by Alan Charles on 10/26/22.
6+
//
7+
8+
import SwiftUI
9+
import Segment
10+
11+
@main
12+
struct SegmentWeatherWidgetApp: App {
13+
var body: some Scene {
14+
WindowGroup {
15+
ContentView()
16+
}
17+
}
18+
}
19+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"platform" : "ios",
6+
"size" : "1024x1024"
7+
}
8+
],
9+
"info" : {
10+
"author" : "xcode",
11+
"version" : 1
12+
}
13+
}

0 commit comments

Comments
 (0)