Skip to content

Instantly share code, notes, and snippets.

@jubishop
Created February 12, 2026 21:17
Show Gist options
  • Select an option

  • Save jubishop/2620a61f150604f9380e4cb2babee287 to your computer and use it in GitHub Desktop.

Select an option

Save jubishop/2620a61f150604f9380e4cb2babee287 to your computer and use it in GitHub Desktop.

❯ can you walk me through these xcode tasks

⏺ Sure. Here's the step-by-step walkthrough:

  1. Create the Widget Extension Target

  2. In Xcode, go to File > New > Target

  3. Search for Widget Extension

  4. Name it PodHavenWidget

  5. Uncheck "Include Live Activity" and "Include Configuration App Intent"

  6. Click Finish

  7. 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.

  1. Add the WIDGET_EXTENSION Compilation Condition

  2. Select the PodHavenWidget target in the project navigator

  3. Go to Build Settings

  4. Search for "Swift Compiler - Custom Flags" or just search "Active Compilation Conditions"

  5. 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

  6. 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:

  1. Select the PodHavenWidget target
  2. Go to Signing & Capabilities
  3. Click + Capability and add App Groups
  4. Check group.podhaven.shared

Verify the entitlements file at PodHavenWidget/PodHavenWidget.entitlements matches what we created (it should just have the app group entry).

  1. 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
  1. Frameworks

The widget target needs WidgetKit, SwiftUI, and AppIntents. Xcode usually links WidgetKit and SwiftUI automatically when you create a widget target. Verify:

  1. Select the PodHavenWidget target

  2. Go to General > Frameworks, Libraries, and Embedded Content

  3. Confirm WidgetKit, SwiftUI, and AppIntents are listed

  4. If AppIntents is missing, click + and add it

  5. Verify the Build

  6. Select the PodHaven scheme (not PodHavenWidget)

  7. Build with Cmd+B — the widget extension should build as a dependency

  8. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment