Skip to content

Feature request: official @perryts/widgets package for WidgetKit / Glance build glue #676

@proggeramlug

Description

@proggeramlug

Feature request: official @perryts/widgets package for WidgetKit / Glance widgets

Perry already supports a --target ios-widget compile target (mentioned in the README) but doesn't ship a package that wraps the build glue needed to:

  1. Compile a sibling SwiftUI WidgetKit extension target with the right SDK + entitlements,
  2. Embed the produced .appex into the host app bundle,
  3. Wire the host app's application-groups entitlement through to the widget,
  4. Mirror the same setup on Android via Glance for app-widgets.

Today every project that ships widgets ends up with a hand-rolled crate-widgets/build.rs that invokes swiftc with target-specific args, plus copy logic to land the binary in the right place inside the .app.

What we'd want

perry widget init <name>      # scaffold a SwiftUI/Glance source tree alongside perry.toml
perry compile --target ios    # picks up [[widget]] entries in perry.toml and builds the .appex

perry.toml:

[[widget]]
name = "TopSitesWidget"
swift_source = "ios-widgets/TopSitesWidget"
display_name = "Top sites"
description = "Best-performing sites this week"
intents = ["TopSitesIntent"]   # AppIntent configuration

[[widget]]
name = "DailyChangeWidget"
swift_source = "ios-widgets/DailyChangeWidget"
glance_source = "android-widgets/DailyChangeGlance"   # optional — Android Glance equivalent

Build glue Perry would handle:

  • iOS: swiftc with -sdk $(xcrun --sdk iphoneos --show-sdk-path), framework search paths (WidgetKit, AppIntents, SwiftUI), correct target triple, embed in Frameworks/<Name>.appex.
  • watchOS: same but --sdk watchos, plus the .appex lives under the watch app's bundle.
  • Android: Compose-Glance source compiled by Gradle wrapper or a perry-controlled invocation; produces a regular AppWidgetProvider.

Per-widget data sharing piggybacks on @perryts/app-group (sister request).

Why this matters

Widgets are increasingly a "must-ship" category on iOS — App Store editorial features prioritize them, and they drive engagement. The current state (hand-rolled build.rs per project) is the single biggest piece of unique infrastructure in our app. Centralising it would unblock a lot of downstream apps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions