Add guides for iOS home screen widgets and App Intents#3216
Add guides for iOS home screen widgets and App Intents#3216jfversluis wants to merge 4 commits intomainfrom
Conversation
Two new documentation guides for integrating Apple platform features: - iOS home screen widgets: SwiftUI widget extensions with App Group shared containers, bidirectional communication, interactive buttons, MSBuild integration, and troubleshooting - App Intents for Siri and Shortcuts: Three-project architecture (Swift framework + binding library + MAUI app), bridge protocol pattern, intent donation, metadata extraction, and build integration Based on: https://github.com/Redth/Maui.Apple.PlatformFeature.Samples Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 397726e:
|
| File | Status | Preview URL | Details |
|---|---|---|---|
| docs/ios/ios-widgets.md | View (>=net-maui-8.0) | Details | |
| docs/ios/app-intents.md | ✅Succeeded | View (>=net-maui-8.0) | |
| docs/TOC.yml | ✅Succeeded | View (>=net-maui-8.0) |
docs/ios/ios-widgets.md
- Line 749, Column 135: [Warning: bookmark-not-found - See documentation]
Cannot find bookmark '#sharedstorageeswift--file-io-via-app-group' in 'ios/ios-widgets.md', did you mean '#sharedstorageswift--file-io-via-app-group'?
For more details, please refer to the build report.
Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.
Fixes from review rounds: - Fix C# heading escapes and broken anchors - Fix NSDate <-> DateTime conversions (DateTimeOffset cast) - Fix enum name mismatches (TaskPriorityLevel/TaskCategoryType) - Add missing class declaration for AppIntentsBridgeProvider - Add ITaskService interface, TaskItem model, and C# enum definitions - Add cross-references to existing entitlements/capabilities docs - Add Info.plist URL scheme registration - Add CI/signing/provisioning notes - Add minimum viable implementation tips - Add UserDefaults vs file-based I/O explanation - Add developer portal App Group note - Add Xcode project creation instructions - Add SchemeName and ForceLoad/SmartLink explanations - Fix MSBuild path separators and split PropertyGroup values - Add WidgetCenterProxy package comment Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Learn Build status updates of commit acfce86: ✅ Validation status: passed
For more details, please refer to the build report. |
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
Pull in step-by-step Xcode widget creation instructions from #3169 and add link to Toine-db's blog post on building iOS widgets with .NET MAUI. Also add widget component descriptions (WidgetBundle, Provider, TimelineEntry, etc.) for developers new to WidgetKit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 9a10e19: ✅ Validation status: passed
For more details, please refer to the build report. |
| Add this target to your MAUI app's `.csproj`: | ||
|
|
||
| ```xml | ||
| <Target Name="CopyAppIntentsMetadata" AfterTargets="_CopyResourcesToBundle" |
There was a problem hiding this comment.
@rolfbjarne should we consider different target here to use? Then also generally speaking, is this concept something we might want to work into the SDK as well?
There was a problem hiding this comment.
Added [!IMPORTANT] notes in commit 22b980b at both MSBuild target locations in app-intents.md (for _CopyResourcesToBundle, _AppBundlePath, and _BuildXcodeProjects) and ios-widgets.md (for _CompileAppManifest) noting these are internal SDK targets that may change in future releases and that built-in support may come in future SDK versions. The SDK design question about which target to use and whether to build this into the SDK is beyond the scope of the docs — deferring to @rolfbjarne on that.
| <ForceLoad>true</ForceLoad> | ||
| <SmartLink>false</SmartLink> |
There was a problem hiding this comment.
These two (ForceLoad+SmartLink) should not be necessary.
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <XcodeProject Include="../YourSwiftFramework/YourSwiftFramework.xcodeproj"> |
There was a problem hiding this comment.
Note that XcodeProject only works when building on a Mac, it doesn't work when building from Windows.
| <Target Name="CopyAppIntentsMetadata" AfterTargets="_CopyResourcesToBundle" | ||
| Condition="$(TargetFramework.Contains('-ios'))"> | ||
| <PropertyGroup> | ||
| <_MetadataSrc>$(MSBuildProjectDirectory)/../YourBindingLibrary/$(IntermediateOutputPath)Metadata.appintents</_MetadataSrc> | ||
| <_MetadataDst>$(_AppBundlePath)/Metadata.appintents/</_MetadataDst> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <_MetadataFiles | ||
| Include="$(_MetadataSrc)/**/*" | ||
| Condition="Exists('$(_MetadataSrc)')" /> | ||
| </ItemGroup> | ||
| <Copy | ||
| SourceFiles="@(_MetadataFiles)" | ||
| DestinationFolder="$(_MetadataDst)%(RecursiveDir)" | ||
| Condition="@(_MetadataFiles->Count()) > 0" /> | ||
| </Target> |
There was a problem hiding this comment.
There's no need to copy manually to the app bundle, just add whatever you want in the app bundle to @(BundleResource): https://gist.github.com/rolfbjarne/038d82de755e0485266864a1b43b35d4
|
|
||
| ```xml | ||
| <Target Name="BuildWidgetExtension" | ||
| BeforeTargets="_CompileAppManifest" |
There was a problem hiding this comment.
CollectAppManifests is a public target:
| BeforeTargets="_CompileAppManifest" | |
| BeforeTargets="CollectAppManifests" |
|
|
||
| ### Simulator testing | ||
|
|
||
| When testing on the simulator, you may need to re-sign the app after building to apply entitlements correctly: |
There was a problem hiding this comment.
Why is that? This sounds like something isn't configured correctly.
| Add this target to your MAUI app's `.csproj`: | ||
|
|
||
| ```xml | ||
| <Target Name="CopyAppIntentsMetadata" AfterTargets="_CopyResourcesToBundle" |
|
@copilot address all comments |
Agent-Logs-Url: https://github.com/dotnet/docs-maui/sessions/fa7b5693-6eea-4183-9cd8-dca2ec3ddea2 Co-authored-by: jfversluis <939291+jfversluis@users.noreply.github.com>
Addressed in commit |
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 22b980b: ✅ Validation status: passed
For more details, please refer to the build report. |
Two new documentation guides for integrating Apple platform features into .NET MAUI iOS apps, based on Maui.Apple.PlatformFeature.Samples:
iOS home screen widgets (
docs/ios/ios-widgets.md)Comprehensive guide covering:
App Intents for Siri and Shortcuts (
docs/ios/app-intents.md)Comprehensive guide covering:
@objcprotocol → C# implementation)<XcodeProject>MSBuild integrationCo-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
Internal previews