❯ can you walk me through these xcode tasks
⏺ Sure. Here's the step-by-step walkthrough:
-
Create the Widget Extension Target
-
In Xcode, go to File > New > Target
-
Search for Widget Extension
-
Name it PodHavenWidget
-
Uncheck "Include Live Activity" and "Include Configuration App Intent"
-
Click Finish
-
When prompted "Activate PodHavenWidget scheme?", click Activate
Xcode will auto-generate some files in a PodHavenWidget/ folder — delete all the auto-generated .swift files it creates (likely something like PodHavenWidget.swift, PodHavenWidgetBundle.swift, AppIntent.swift, etc.) since we already have our own versions at the paths we created. Also delete any auto-generated Assets.xcassets in that folder if present.
-
Add the WIDGET_EXTENSION Compilation Condition
-
Select the PodHavenWidget target in the project navigator
-
Go to Build Settings
-
Search for "Swift Compiler - Custom Flags" or just search "Active Compilation Conditions"
-
Add WIDGET_EXTENSION to all configurations (Debug, Release, and Test if present) — just double-click the value field and add it alongside the existing DEBUG entry
-
Configure the App Group Entitlement
Xcode may have already created an entitlements file for the widget target. If so, check that it matches what we wrote. If not:
- Select the PodHavenWidget target
- Go to Signing & Capabilities
- Click + Capability and add App Groups
- Check group.podhaven.shared
Verify the entitlements file at PodHavenWidget/PodHavenWidget.entitlements matches what we created (it should just have the app group entry).
- Add Files to the Correct Targets
This is the most important part. Select each file in the Project Navigator and use the File Inspector (right panel, first tab) to check/uncheck target membership:
Files in BOTH targets (PodHaven + PodHavenWidget)
Select each of these 5 files and check both target checkboxes:
- PodHaven/Widget/WidgetConstants.swift
- PodHaven/Widget/WidgetSnapshot.swift
- PodHaven/Widget/Intents/PlayPauseIntent.swift
- PodHaven/Widget/Intents/SkipForwardIntent.swift
- PodHaven/Widget/Intents/SkipBackwardIntent.swift
Files in PodHaven target ONLY
These should already be in the main target. Just verify they are not checked for PodHavenWidget:
- PodHaven/Widget/WidgetSnapshotWriter.swift
Files in PodHavenWidget target ONLY
You need to add these to the project first if Xcode doesn't already see them. Right-click the PodHavenWidget group in the Project Navigator > Add Files to "PodHaven" > navigate to the PodHavenWidget/ folder and add all the .swift files. Make sure the target membership is set to PodHavenWidget only (not the main app):
- PodHavenWidget/PodHavenWidgetBundle.swift
- PodHavenWidget/Shared/WidgetSnapshotReader.swift
- PodHavenWidget/NowPlaying/NowPlayingEntry.swift
- PodHavenWidget/NowPlaying/NowPlayingWidget.swift
- PodHavenWidget/NowPlaying/NowPlayingWidgetView.swift
- PodHavenWidget/Queue/QueueEntry.swift
- PodHavenWidget/Queue/QueueWidget.swift
- PodHavenWidget/Queue/QueueWidgetView.swift
- Frameworks
The widget target needs WidgetKit, SwiftUI, and AppIntents. Xcode usually links WidgetKit and SwiftUI automatically when you create a widget target. Verify:
-
Select the PodHavenWidget target
-
Go to General > Frameworks, Libraries, and Embedded Content
-
Confirm WidgetKit, SwiftUI, and AppIntents are listed
-
If AppIntents is missing, click + and add it
-
Verify the Build
-
Select the PodHaven scheme (not PodHavenWidget)
-
Build with Cmd+B — the widget extension should build as a dependency
-
If you get errors about @main conflicts, make sure the auto-generated Xcode widget files were deleted and only our PodHavenWidgetBundle.swift has @main
The most common issue is forgetting to delete Xcode's auto-generated files or having wrong target memberships. If you hit any specific build errors, let me know and I can help debug them.