Set up the @main App struct for FOSMVVM SwiftUI apps. Configures MVVMEnvironment, deployment URLs, and test infrastructure.
Generate the main App struct for a SwiftUI application using FOSMVVM architecture.
For full architecture context, see FOSMVVMArchitecture.md | OpenClaw reference
The App struct is the entry point of a SwiftUI application. In FOSMVVM, it has three core responsibilities:
CODEBLOCK0
The MVVMEnvironment provides FOSMVVM infrastructure to all views:
CODEBLOCK1
Key configuration:
appBundle - Usually Bundle.main (the app bundle)Resource Bundle Accessors:
Each module that contains localization resources should provide a bundle accessor:
CODEBLOCK2
This pattern:
Bundle.module which SPM automatically provides for each moduleThe MVVMEnvironment is injected at the WindowGroup level:
CODEBLOCK3
This makes the environment available to all views in the hierarchy.
The test infrastructure enables UI testing with specific configurations:
.testHost { } modifier:
CODEBLOCK4
Key points:
default: case@State private var underTest = false flagregisterTestingViews() function:
CODEBLOCK5
Key points:
| Component | Location | Purpose |
|---|---|---|
| Main App struct | INLINECODE12 | Entry point with MVVMEnvironment setup |
| MVVMEnvironment configuration |
| Placeholder | Description | Example |
|---|---|---|
| INLINECODE13 | Your app name | INLINECODE14 , INLINECODE15 |
| INLINECODE16 |
App |
| {ResourceBundles} | Module names with localization | MyAppViewModels, SharedResources |
Invocation:
/fosmvvm-swiftui-app-setup
Prerequisites:
Workflow integration:
This skill is used when setting up a new FOSMVVM SwiftUI application or adding FOSMVVM infrastructure to an existing app. The skill references conversation context automatically—no file paths or Q&A needed.
This skill references conversation context to determine App struct configuration:
From conversation context, the skill identifies:
Based on project structure:
If test support needed:
Skill references information from:
The MVVMEnvironment is a computed property, not a stored property:
CODEBLOCK6
Why computed?
The default test detection uses process arguments:
CODEBLOCK7
Why this approach?
Every ViewModelView should be registered for testing:
CODEBLOCK8
Organization tips:
You can inject multiple environment values:
CODEBLOCK9
You can conditionally register views based on build configuration:
CODEBLOCK10
You can add specific test configurations in .testHost:
CODEBLOCK11
See reference.md for complete file templates.
| Concept | Convention | Example |
|---|---|---|
| App struct | INLINECODE23 | INLINECODE24 , INLINECODE25 |
| Main file |
{Name}App.swift | MyApp.swift |
| MVVMEnvironment property | mvvmEnv | Always mvvmEnv |
| Test flag | underTest | Always underTest |
FOSMVVM supports deployment detection via Info.plist:
CODEBLOCK12
Local development override:
| Version | Date | Changes |
|---|---|---|
| 1.0 | 2026-01-23 | Initial skill for SwiftUI app setup |
| 1.1 |
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 fosmvvm-swiftui-app-setup-1776420040 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 fosmvvm-swiftui-app-setup-1776420040 技能
skillhub install fosmvvm-swiftui-app-setup-1776420040
文件大小: 8.46 KB | 发布时间: 2026-4-17 20:21