Skip to content

ahmetbostanciklioglu/InteractiveSnippetsSwiftUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

☕ Interactive Snippets in SwiftUI

A multi-step latte-ordering flow built with iOS 26 Interactive Snippets and App Intents.

Platform Swift SwiftUI Xcode Stars Last Commit

📖 Overview

Interactive Snippets is a small SwiftUI demo that shows how to build a rich, multi-step interaction using Apple's new iOS 26 SnippetIntent API. Running the "Order a Latte" App Intent walks the user through picking a size, adjusting the milk percentage and shot count with tappable buttons, confirming the order, and finally showing an "Order Placed" summary — all inside interactive snippet views that surface in Shortcuts and the home-screen widget menu.

It is a focused learning project that demonstrates how AppIntent, SnippetIntent, requestChoice, requestConfirmation, and Button(intent:) compose into a stateful, in-snippet flow backed by a shared dependency.

✨ Features

  • Multi-step App Intent flowOrderLatteIntents chains size selection, milk confirmation, and count confirmation into a single "Order a Latte" action.
  • Interactive snippet viewsMilkPercentageConfirmationIntent and LatteCountConfirmationIntent are SnippetIntents that render a live LatteOrderView for each step.
  • In-snippet action buttonsButton(intent:) fires LatteActionIntent to increment/decrement the milk percentage (0–100% in 10% steps) and shot count (1–10) directly inside the snippet.
  • Shared dependency state — a LatteOrderManager is registered via AppDependencyManager and injected with @Dependency, so every intent reads and mutates the same order.
  • Choice + confirmation prompts — uses requestChoice for the latte size and requestConfirmation to gate the milk and order steps.
  • Order summary UI — a gradient LatteOrderView shows the selected size, milk percentage, and count, ending with an "Order Placed" state.

📸 Preview

Interactive snippet — select latte size Interactive snippet — adjust milk and count Interactive snippet — order placed
Adding the snippet in Shortcuts
Shortcuts configuration
Adding the snippet to the home widget menu

Tip: Open the snippet from Shortcuts by choosing this app, then add the snippet to a widget from the Home Screen menu.

🚀 Getting Started

git clone https://github.com/ahmetbostanciklioglu/InteractiveSnippetsSwiftUI.git
cd InteractiveSnippetsSwiftUI
open InteractiveSnippetsSwiftUI.xcodeproj

Then select an iOS 26 simulator (or device) and press ⌘R to build and run. Trigger the "Order a Latte" intent from Shortcuts to see the interactive snippets in action.

📋 Requirements

  • iOS 26.1+
  • Xcode 26+
  • Swift 5.0

🧑‍💻 Author

Ahmet Bostancıklıoğlu@ahmetbostanciklioglu · ahmetbostancikli@gmail.com

⭐ If this helped you, consider giving the repo a star!

About

Multi-step latte-ordering demo using iOS 26 Interactive Snippets, SnippetIntent, and App Intents in SwiftUI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages