# sjj1024/pakeplus-ios architecture

> Architecture diagram of the GitHub repository sjj1024/pakeplus-ios, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sjj1024/pakeplus-ios
- Repository: https://github.com/sjj1024/pakeplus-ios

## Overview

#### Purpose and Scope
PakePlus-iOS is a native iOS shell for turning a remote webpage or bundled static site into a lightweight app. The repository contains an Xcode SwiftUI application plus embedded HTML/JavaScript resources and an IPA artifact. Its native entry point is `PakePlus/PakePlusApp.swift`.

#### Native Application Composition
The app is a Swift/SwiftUI project defined by `PakePlus.xcodeproj/project.pbxproj`. `PakePlus/PakePlusApp.swift` creates the application scene, while `PakePlus/ContentView.swift` provides the primary host view. App metadata, capabilities, icons, and branding are bounded by:
- `PakePlus/Info.plist`
- `PakePlus/PakePlus.entitlements`
- `PakePlus/Assets.xcassets`

#### Web Runtime Boundary
`PakePlus/WebView.swift` is the key native-to-web boundary: it hosts web content in the iOS web runtime and is the integration point for navigation, loading either a target URL or packaged content, and web/native behavior. Web-facing assets live alongside the native app:
- `PakePlus/index.html`
- `PakePlus/custom.js`
- `PakePlus/vConsole.js`

This separation lets packaged web UI execute in the embedded browser while platform lifecycle and presentation remain native.

#### Native Navigation and Presentation
The native shell has distinct view components for application structure and navigation:
- `PakePlus/ContentView.swift`
- `PakePlus/SideBarView.swift`
- `PakePlus/TabBarView.swift`

Control flow is expected to originate in SwiftUI scene creation, compose the navigation views, then present the `WebView` as the application content surface. The sidebar/tab components are the principal native UI layer around the embedded webpage.

#### Injected and Support Web Content
Custom JavaScript is an explicit extension mechanism for altering or automating the hosted page. The bundled console script supports in-app web debugging. Supporting web resources used by packaging/build flows include:
- `scripts/assets/vConsole.js`
- `scripts/www/pppwd.html`
- `scripts/ppconfig.json`

The important trust boundary is between arbitrary remote/injected web code and the iOS WebView host; changes here affect behavior inside every packaged target page.

#### Build, Distribution, and Automation
Xcode produces the iOS app, with the checked-in project at `PakePlus.xcodeproj`. JavaScript package orchestration is represented by `package.json`, `pnpm-lock.yaml`, and the worker `scripts/ppworker.cjs`. GitHub Actions provides cloud build/release automation through:
- `.github/workflows/build.yml`
- `.github/back/build.yml`

A prebuilt distribution artifact is present at `packages/com.pakeplus.xiao.shen_0.0.1.ipa`. The README also describes GitHub-token-driven packaging, where external GitHub Actions and Releases are material services for creating and retrieving builds.

Main entry points: [`PakePlus/WebView.swift`](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/WebView.swift) (WebView bridge), [`PakePlus/ContentView.swift`](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/ContentView.swift) (Content host), [`.github/workflows/build.yml`](https://github.com/sjj1024/pakeplus-ios/blob/main/.github/workflows/build.yml) (GitHub Actions build), [`PakePlus.xcodeproj/project.pbxproj`](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus.xcodeproj/project.pbxproj) (Xcode project)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ios["Native iOS Shell"]
  node_xcode_project["Xcode project<br/>[project.pbxproj]"]
  node_app_entry["SwiftUI app entry<br/>[PakePlusApp.swift]"]
  node_content_view["Content host<br/>swiftui view<br/>[ContentView.swift]"]
  node_sidebar["Sidebar navigation<br/>swiftui view<br/>[SideBarView.swift]"]
  node_tabbar["Tab navigation<br/>swiftui view<br/>[TabBarView.swift]"]
  node_webview{{"WebView bridge<br/>native-web boundary<br/>[WebView.swift]"}}
  node_app_metadata["App metadata &amp; capabilities<br/>iOS resources<br/>[Info.plist]"]
  node_assets["Branding assets<br/>asset catalog<br/>[Assets.xcassets]"]
end

subgraph group_web["Embedded Web Runtime"]
  node_bundled_page["Bundled web page<br/>HTML<br/>[index.html]"]
  node_custom_js["Injected custom JS<br/>JavaScript<br/>[custom.js]"]
  node_web_console["Bundled web console<br/>JavaScript<br/>[vConsole.js]"]
  node_remote_page{{"Remote target page<br/>external web content"}}
end

subgraph group_build["Build &amp; Distribution"]
  node_package_config["Package orchestration<br/>Node package config<br/>[package.json]"]
  node_packaging_worker["Packaging worker<br/>Node worker<br/>[ppworker.cjs]"]
  node_packaging_resources["Packaging web resources<br/>build resources<br/>[ppconfig.json]"]
  node_github_actions{{"GitHub Actions build<br/>CI workflow<br/>[build.yml]"}}
  node_github_releases["GitHub Releases<br/>external distribution"]
  node_ipa["Prebuilt IPA<br/>iOS artifact"]
end

node_xcode_project -->|"builds"| node_app_entry
node_xcode_project -->|"includes"| node_app_metadata
node_xcode_project -->|"includes"| node_assets
node_app_entry -->|"creates scene"| node_content_view
node_content_view -->|"composes"| node_sidebar
node_content_view -->|"composes"| node_tabbar
node_content_view -->|"presents"| node_webview
node_webview -->|"loads packaged"| node_bundled_page
node_webview -->|"navigates to"| node_remote_page
node_webview -->|"injects"| node_custom_js
node_webview -.->|"loads debugging support"| node_web_console
node_package_config -->|"orchestrates"| node_packaging_worker
node_packaging_worker -->|"uses"| node_packaging_resources
node_packaging_worker -.->|"drives cloud packaging"| node_github_actions
node_github_actions -->|"builds"| node_xcode_project
node_github_actions -->|"produces"| node_ipa
node_github_actions -->|"publishes"| node_github_releases
node_github_releases -.->|"distributes"| node_ipa

click node_xcode_project "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus.xcodeproj/project.pbxproj"
click node_app_entry "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/PakePlusApp.swift"
click node_content_view "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/ContentView.swift"
click node_sidebar "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/SideBarView.swift"
click node_tabbar "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/TabBarView.swift"
click node_webview "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/WebView.swift"
click node_app_metadata "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/Info.plist"
click node_assets "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/Assets.xcassets"
click node_bundled_page "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/index.html"
click node_custom_js "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/custom.js"
click node_web_console "https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/vConsole.js"
click node_package_config "https://github.com/sjj1024/pakeplus-ios/blob/main/package.json"
click node_packaging_worker "https://github.com/sjj1024/pakeplus-ios/blob/main/scripts/ppworker.cjs"
click node_packaging_resources "https://github.com/sjj1024/pakeplus-ios/blob/main/scripts/ppconfig.json"
click node_github_actions "https://github.com/sjj1024/pakeplus-ios/blob/main/.github/workflows/build.yml"
click node_ipa "https://github.com/sjj1024/pakeplus-ios/blob/main/packages/com.pakeplus.xiao.shen_0.0.1.ipa"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_xcode_project,node_app_entry,node_content_view,node_sidebar,node_tabbar,node_webview,node_app_metadata,node_assets toneBlue
class node_bundled_page,node_custom_js,node_web_console,node_remote_page toneAmber
class node_package_config,node_packaging_worker,node_packaging_resources,node_github_actions,node_github_releases,node_ipa toneMint
```

## Components

### Native iOS Shell

- [Xcode project](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus.xcodeproj/project.pbxproj): project · Defines the iOS application build. · `PakePlus.xcodeproj/project.pbxproj`
- [SwiftUI app entry](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/PakePlusApp.swift): swiftui · `PakePlus/PakePlusApp.swift`
- [Content host](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/ContentView.swift): swiftui view · `PakePlus/ContentView.swift`
- [Sidebar navigation](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/SideBarView.swift): swiftui view · `PakePlus/SideBarView.swift`
- [Tab navigation](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/TabBarView.swift): swiftui view · `PakePlus/TabBarView.swift`
- [WebView bridge](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/WebView.swift): native-web boundary · Loads packaged or remote content and mediates web/native behavior. · `PakePlus/WebView.swift`
- [App metadata & capabilities](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/Info.plist): iOS resources · `PakePlus/Info.plist`
- [Branding assets](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/Assets.xcassets): asset catalog · `PakePlus/Assets.xcassets`

### Embedded Web Runtime

- [Bundled web page](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/index.html): HTML · `PakePlus/index.html`
- [Injected custom JS](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/custom.js): JavaScript · Extension mechanism for hosted pages. · `PakePlus/custom.js`
- [Bundled web console](https://github.com/sjj1024/pakeplus-ios/blob/main/PakePlus/vConsole.js): JavaScript · `PakePlus/vConsole.js`
- **Remote target page**: external web content · Arbitrary hosted content executes inside the embedded browser.

### Build & Distribution

- [Package orchestration](https://github.com/sjj1024/pakeplus-ios/blob/main/package.json): Node package config · `package.json`
- [Packaging worker](https://github.com/sjj1024/pakeplus-ios/blob/main/scripts/ppworker.cjs): Node worker · `scripts/ppworker.cjs`
- [Packaging web resources](https://github.com/sjj1024/pakeplus-ios/blob/main/scripts/ppconfig.json): build resources · `scripts/ppconfig.json`
- [GitHub Actions build](https://github.com/sjj1024/pakeplus-ios/blob/main/.github/workflows/build.yml): CI workflow · `.github/workflows/build.yml`
- **GitHub Releases**: external distribution · Receives and serves packaged builds.
- [Prebuilt IPA](https://github.com/sjj1024/pakeplus-ios/blob/main/packages/com.pakeplus.xiao.shen_0.0.1.ipa): iOS artifact · `packages/com.pakeplus.xiao.shen_0.0.1.ipa`

## Connections

- Xcode project → SwiftUI app entry: builds
- Xcode project → App metadata & capabilities: includes
- Xcode project → Branding assets: includes
- SwiftUI app entry → Content host: creates scene
- Content host → Sidebar navigation: composes
- Content host → Tab navigation: composes
- Content host → WebView bridge: presents
- WebView bridge → Bundled web page: loads packaged
- WebView bridge → Remote target page: navigates to
- WebView bridge → Injected custom JS: injects
- WebView bridge → Bundled web console: loads debugging support
- Package orchestration → Packaging worker: orchestrates
- Packaging worker → Packaging web resources: uses
- Packaging worker → GitHub Actions build: drives cloud packaging
- GitHub Actions build → Xcode project: builds
- GitHub Actions build → Prebuilt IPA: produces
- GitHub Actions build → GitHub Releases: publishes
- GitHub Releases → Prebuilt IPA: distributes
