Skip to content

Add macOS PWA package generation (native AppKit WKWebView wrapper) - #6176

Draft
Judah Gabriel Himango (JudahGabriel) with Copilot wants to merge 4 commits into
mainfrom
copilot/macos-app-package-generation
Draft

Add macOS PWA package generation (native AppKit WKWebView wrapper)#6176
Judah Gabriel Himango (JudahGabriel) with Copilot wants to merge 4 commits into
mainfrom
copilot/macos-app-package-generation

Conversation

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Mac users installing a PWA via Safari get a persistent toolbar (back/forward/share/extensions) with no developer workaround. Chrome/Edge installs are toolbar-free but require users to know this. This adds a macOS package generator that produces a native AppKit + WKWebView app — no browser chrome, identical to Chrome/Edge PWA install, distributable as a .zip containing an Xcode project (same sideload model as the Windows MSIX generator).

The existing iOS template was not reused — it uses UIKit throughout (UIViewController, UIApplication, UIDevice) and is incompatible with native macOS. Mac Catalyst was rejected as it still shows browser chrome.

Swift template (Resources/macOS/macos-project-src/)

  • AppDelegate.swift — Creates NSWindow with .fullSizeContentView style mask; applies manifest theme_color to title bar via titlebarAppearsTransparent + backgroundColor
  • ViewController.swiftWKWebView filling the full window; navigation policy enforcing allowed/external origins; WKUIDelegate handling JS alert/confirm/prompt; loading spinner; platform cookie injection
  • Settings.swift — Template placeholders ({{PWABuilder.macOS.url}}, {{PWABuilder.macOS.bundleId}}, {{PWABuilder.macOS.themeColor}}, etc.) replaced at generation time
  • Info.plistNSPrincipalClass=NSApplication, WKAppBoundDomains, NSAppTransportSecurity
  • project.pbxprojSDKROOT=macosx, MACOSX_DEPLOYMENT_TARGET=13.0, no CocoaPods

C# backend

  • MacOSAppPackageOptions / XcodeMacOSProject — Options model + template substitution engine (extends XcodeProject base; replaces tokens in Swift, plist, and pbxproj files; renames pwa-shell/ dir to app name)
  • MacOSImageWriter — Generates macOS icon sizes: 16, 32, 64, 128, 256, 512, 1024px
  • MacOSPackageCreator — Copy template → write icons → substitute tokens → zip
  • MacOSPackageControllerPOST /api/MacOSPackage/Create → returns zip download
  • AppSettings + appsettings.json get MacOSSourceCodePath / MacOSNextStepsPath
  • Both services registered as transient in Program.cs

TypeScript frontend

  • utils/macos-validation.tsMacOSAppPackageOptions interface, generateMacOSBundleId() (reverse-domain from host), validateMacOSOptions()
  • services/publish/macos-publish.tsgenerateMacOSPackage(), createMacOSPackageOptionsFromManifest() (pre-populates from manifest), emptyMacOSPackageOptions()
  • services/publish/index.ts'macos' added to Platform type; tryGenerateMacOSPackage() case added to generatePackage() switch
  • components/macos-form.ts<macos-form> Lit component; basic fields: Bundle ID, App Name, URL; advanced (collapsible): Image URL, Theme Color, Background Color, Permitted URLs
  • components/publish-pane.ts — macOS card added to platform list (marked "Experimental"); showMacOSOptions(), renderMacOSDownloadButton(), renderForm() case for "macOS"; ICardData union types extended
  • utils/environment.tsmacosPackageGeneratorUrl added (/api/macospackage/create)

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thanks @Copilot for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

Copilot AI changed the title [WIP] Add macOS app package generation support Add macOS PWA package generation (native AppKit WKWebView wrapper) Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS App Package Generation

2 participants