Booky heavily-commented demo app built to explore Apple's new 'App Intents' framework introduced in iOS 16

Overview

Booky Demo App

alt text

ℹ️ ABOUT

Booky is a work-in-progress, heavily-commented demo app built to explore Apple's new 'App Intents' framework introduced in iOS 16.

This API lets you extend actions from your app into other areas of the OS - for example the Shortcuts app and Siri.

Functionally, Booky is a basic library you can add books to and mark them as read or unread. It's runnable code that is conceptually and structurally similar to the examples provided in WWDC22's 'Dive Into App Intents' session.

Technically, Booky is built using SwiftUI and persists saved books to a local CoreData store. It has only been tested on iPhone but the code should run on iPad (though the UI hasn't been optimised for it yet).

When you first open the app, three dummy books will be added to the library for testing. Please note that the functionality is extremely bare bones. Testing, error handling and localization are all currently absent. Hopefully, however, it'll be a useful playground to help explore some of what the App Intents framework has to offer.

There are some known issues with the app (see 'Known Issues' below) - I'll try and iron these out as the betas progress.

Here are some of the things covered by Booky:

  • 5x Shortcut actions
  • Foreground & background actions
  • Conditional parameter summaries
  • Rich confirmation prompts
  • Dynamic lookup parameters with thumbnails and subtitles
  • Custom entity with queryable properties
  • Action library categories
  • Custom errors
  • Snippet results

⚙️ SHORTCUTS ACTIONS

Booky has five actions (or 'intents') that it provides to the Shortcuts app:

ADD BOOK

Add a new book to the library.

This action has properties of various types which support different input options, such as per-word keyboard capitalization.

It displays a SwiftUI 'Snippet' UI (functionally similar to a Homescreen widget) showing a preview of the new book when it completes successfully.

It also outputs a rich custom 'Book' entity for use in the next action.

MARK BOOKS AS READ

Mark multiple books as either read or unread.

This action has a parameter that accepts an array of a custom Book entities. When tapped, it populates a dynamic, filterable list of Books that display along with images. It is sectioned into a 'read' & 'unread' section using a DynamicOptionsProvider.

It also demonstrates how to use an enum to create a fixed multiple-choice parameter.

OPEN BOOK

Opens the chosen book in the Booky app or navigates to the root library view.

This action demonstrates how to perform a foreground action in your app from Shortcuts. It opens the app and uses the new programmatic navigation API in SwiftUI to either jump to a specific detail view or clear the navigation stack.

It uses the Switch/Case API in ParameterSummary to display a conditional summary depending on which option is chosen.

DELETE BOOKS ⚠️

Deletes the selected books from the library.

This action demonstrates how to prompt the user with an optional confirmation (containing images in a Snippet) before deleting the books.

It uses the ParameterSummary's When/Otherwise API.

FIND BOOKS ⚠️

New in iOS 16, this action is automatically added when you add a custom entity with a query that conforms to EntityPropertyQuery (Not sure this is actually correct since it currently shows when conforming to EntityStringQuery/EntityQuery too?).

This action allows the user to query Booky's database for Books using combinations of property queries. For example: Books published after the year 2000 that are unread.


REQUIREMENTS

The iOS16 & Xcode 14 betas.

If Booky's shortcut actions aren't showing in the Shortcuts app, make sure xcode-select is pointing to the correct Xcode, as per the Xcode release notes for Dev Beta 1

alt text


⚠️ KNOWN ISSUES

  • The 'Find Books' action isn't working yet. I don't think it should actually even show when there isn't a query that conforms to EntityStringQuery, which there currently isn't. I'm working on adding conformance to EntityParameterQuery to get it working properly but having some issues. The display name is also not showing correctly (FB10210421)
  • When tapping on an action's parameter that accepts a custom ShortcutsBookEntity, the filtering isn't working. The entities(matching String) never seems to get called. (FB10213109)
  • The Delete Books parameter sumary doesn't show correctly, instead showing as if none has been set. I believe this is an issue with ParameterSummary's When/Otherwise API (FB10208191)
  • Input options seem to have no effect - for example the Title & Author parameters in the Add Book action should be capitalized by word (FB10200372)
  • The text colour in a Snippet view doesn't show the correct (lighter) colour in dark mode (FB10209882)
  • Long-pressing a File parameter in the list UI (as opposed to the parameter summary) has no effect, which makes it impossible to select a magic variable (FB10191345)

🎓 STILL TO EXPLORE


📚 FURTHER READING


📨 CONTACT

Questions, code contributions & contructive feedback welcome. I don't have a clue what I'm doing.

You can find me on Twitter: @mralexhay.

You might also like...
Trivia about Animal Crossing: New Horizons. My first iOS (iPhone) app.

ACNH-trivia-iOS-app Trivia about Animal Crossing: New Horizons. This is my first iOS (iPhone) app. I am excited to start my journey as an iOS develope

A cross-platform SwiftUI-like framework built on SwiftGtk.

SwiftGtkUI A SwiftUI-like framework for creating cross-platform apps in Swift. It uses SwiftGtk as its backend. NOTE: SwiftGtkUI does not attempt to r

WeHobby is an IOS application which aims to facilitate the discovery of new hobbies while creating links between users.

🇬🇧 WeHobby (EN) WeHobby is an IOS application which aims to facilitate the discovery of new hobbies while creating links between users. The issues t

A demo app to showcase testable, modern iOS development with SwiftUI and Combine on MVVM-C architecture.

Coinz_App_iOS A demo app to showcase testable, modern iOS development with SwiftUI and Combine on MVVM-C architecture. Tech Stack: Swift, SwiftUI, Com

An iOS app demo to show list and detail screen of artworks.
An iOS app demo to show list and detail screen of artworks.

Artworks iOS Demo Application Architecture MVP Clean Architecture (check Known Issues) Dependency Injection Features Localization Dark mode support Ba

Animal Crossing New Horizon companion app in SwiftUI
Animal Crossing New Horizon companion app in SwiftUI

You can now download the app on the App Store! The best Animal Crossing New Horizons companion app! 最高の「あつまれ どうぶつの森」コンパニオンアプリ Animal Crossing New Hori

Beers is a simple experimental app implemented using the new amazing SwiftUI.
Beers is a simple experimental app implemented using the new amazing SwiftUI.

Beers is a simple experimental app implemented using the new amazing SwiftUI. The app shows a list of beers fetched from Punk API

A simple todo app which aims to demonstrate some new concepts from SwiftUI 3
A simple todo app which aims to demonstrate some new concepts from SwiftUI 3

TodoAppSwiftUI3 A simple todo app which aims to demonstrate some new concepts from SwiftUI 3 Description This is a simple todo app built to demonstrat

A Quick macOS app that will check a website's sitemap.xml against a new domain
A Quick macOS app that will check a website's sitemap.xml against a new domain

Migrator Quick and dirty native macOS app that will check a website's sitemap.xml against a new domain. When you're developing your new website and wa

Comments
  • Zero user setup not working

    Zero user setup not working

    The zero user setup is not working in xcode 14.1. I have used AppShorcutsProvider protocol it's not working in xcode 14.1 but in xcode 14.0 beta zero user setup works. Is there any workaround for that?

    opened by vishwakneelamegam 1
  • Added initial AppIntent to delete book

    Added initial AppIntent to delete book

    The initial app intent has a parameter and disambiguation, and multiple trigger phrases. There is currently no confirmation on delete.

    There is an issue where Siri is not dismissed after returning, which I am unsure of the cause currently.

    When the app appears the values are updated for the App Intent / App Shortcut, but this should also be done when the library changes.

    opened by jknlsn 0
Owner
Alex Hay
Alex Hay
SpaceAidExplorer - An app made for students who are not from Naples to explore places in and near Naples.

SpaceAidExplorer - An app made for students who are not from Naples to explore places in and near Naples. Made with love in Naples! Team Members Nicolas

Rishabh Dev 0 Nov 16, 2021
Basic Todo list application built using the new SwiftUI framework and Core Data

Dub Dub Do - A sample TODO List Application in SwiftUI Updated for Xcode 11.5 This is a basic app that lets you create a list of todos, mark them as i

Stephen McMillan 67 Sep 28, 2022
RippleQueries is an iOS application built as assessment task at Ripple Egypt. Built Using MVVM (Model-View-ViewModel) and Clean Architecture concepts

RippleRepositories RippleRepositories is an iOS application built as an assessment task at Ripple Egypt. Built Using RxSwift & MVVM (Model-View-ViewMo

Muhammad Ewaily 3 Sep 16, 2021
E-commerce app built in SwiftUI. Built in the course SwiftUI Masterclass in Udemy.

Touchdown-SwiftUI E-commerce app built in SwiftUI. Built in the course SwiftUI Masterclass in Udemy. Main components and concepts used: @EnvironmentOb

Jorge Martinez 5 Aug 18, 2022
Unidirectional reactive architecture using new Apple Combine framework

Unidirectional Reactive Architecture. This is a Combine implemetation of ReactiveFeedback and RxFeedback

null 687 Nov 25, 2022
Examples of new SwiftUI framework

SwiftUI by Examples SwiftUI is a simple way to build user interfaces across all Apple platforms with the power of Swift. I'm going to fill the repo wi

Artem Novichkov 192 Dec 9, 2022
Demo to show Air Quality Indices of Cities (in India) using SwiftUI and Combine Framework

AirQualityMonitoring-SwiftUI-Combine Demo to show Air Quality Indices of Cities (in India) using SwiftUI and Combine Framework Demo Video City List wi

Minhaz Panara 0 Jan 23, 2022
Sample iOS project built by SwiftUI + Flux and Combine framework using GitHub API

SwiftUI-Flux Flux enables us to have unidirectional data flow and make it testable. It's used to be implemented using RxSwift or ReactiveSwift in the

Yusuke Kita 87 Nov 25, 2022
Sample iOS project built by SwiftUI + MVVM and Combine framework using GitHub API

SwiftUI-MVVM One of the biggest idea for having MVVM is that most of data flow can be testable. Data binding in view layer by SwiftUI is awesome. Howe

Yusuke Kita 592 Jan 2, 2023
Ios-exercise - In this exercise applicant should implement a new feature into an existing sample app

Cooking app In this exercise applicant should implement a new feature into an ex

Kristīne 0 Feb 7, 2022