An interesting problem appeared in the first internal build of NetNewsWire 6: the app size was much bigger—almost 4x bigger—than NetNewsWire 5. On investigation, the Sparkle framework—now included in the app as a Binary Target via a Swift Package—was appearing in multiple places in the archived package.

Ideally, Xcode should only include the Sparkle framework in the Frameworks folder of the package. In the case of NetNewsWire 6, it appeared in Frameworks, PlugIns, and XPCServices, resulting in a 25% increase to the app’s install size.

It turns out that this behaviour is a bug. Any time there is an Embed phase in Build Phases, the framework is copied to that folder:

  • Embed Frameworks: Sparkle was copied to the Frameworks folder
  • Embed XPC Services: Sparkle was copied to the XPC Services folder
  • Embed App Extensions: Sparkle was copied to the PlugIns folder

The current workaround is to remove the Sparkle framework using a Build Phase script. See the below example for NetNewsWire:

PLUGINS_DIR="${CODESIGNING_FOLDER_PATH}/Contents/PlugIns"
XPC_DIR="${CODESIGNING_FOLDER_PATH}/Contents/XPCServices"
find "${PLUGINS_DIR}" -name Sparkle* -execdir rm -rf {} \;
find "${XPC_DIR}" -name Sparkle* -execdir rm -rf {} \;

The bug on the Swift bug tracker really ought to be rated higher than Medium: this behaviour will result in rejections from the App Store.