Siri Intents arrive in Flint ea-1.0.5

We’ve finally converged on a clean API for Siri Intent support! Our FlintDemo-iOS example project has been updated to implement an Intent Extension which is literally just a few lines of code using this new API.

In this release we now have persistent file-based logging making its first appearance. You can set up logging to files and have those logs captured in the debug report zip that Flint can produce for you.

Under the hood there were some great API and implementation improvements. The internal action binding types no longer capture type information they didn’t need, some concurrency issues were solved, along with several little naming improvements.

Source breaking change — activityTypes

We decided to rename the Action property convention activityTypes to activityEligibility to avoid confusion with NSUserActivity and its activityType property which is a different thing.

To update your code just search and replace!

Create Siri Intents

This has been a long time coming, but we have settled on a simple API that leverages our existing Action patterns while making it very simple to create Siri Intents that reside in Intent Extensions. There are a number of challenges with making Intents, starting with trying to unravel the complex overloaded terminology and vast range of behaviours through to the asynchronous nature of their execution.

Our Intent support takes care of the coding-side issues for you with the Action pattern that means your intents continue to benefit from all the Flint superpowers; contextual logging, analytics, permissions and conditional features.

The TL:DR; is that you create an action that conforms to IntentAction, providing a way to convert your InputType to and from the INIntent type, and you call perform on this in your extension:

class GetNoteIntentHandler: NSObject, GetNoteIntentHandling {
    func handle(intent: GetNoteIntent, completion: @escaping (GetNoteIntentResponse) -> Void) {
        let outcome = SiriFeature.getNote.perform(intent: intent, completion: completion)
        assert(outcome == .success, "Intent failed: \(outcome)")

The action itself does the work, keeping the logic out of your intent handlers.

Your action can render results directly into Siri which are displayed or spoken. You can also redirect Siri if there is any problem to open your app with another Action via Activities. It is also simple to donate your intents explicitly for any given input with donateToSiri(for:) on your actions.

Let us know what you think of the APIs and show us what you create!

For full details see the updated Shortcuts programming guide and the FlintDemo-iOS project.

Logging to files

We now have a basic FileLoggerOuput implementation which produces logs that can be gathered together in the debug report zip automatically.

All you need to do is use Flint.setup instead of the Flint.quickSetup function to bootstrap Flint, so that you can pass in your own loggers. For full details see the updated logging documentation.

While we were working on this we also improved the PrintLoggerOutput and OSLogOutput implementations to use a new LogEventFormattingStrategy protocol to produce the text that is logged. This means log output is consistent across all loggers and allows you to completely customise output with your own formatter.

We’ll be adding support for maximum size limits and rolling log files in a future release.

New logging control functions

We added new setLoggingLevel and disableLogging convenience functions on all Features to selectively change logging levels at runtime. You just calle MyFeatture.disableLogging() to shut off logging for everything related to just that feature.

New persistentIdentifier property on ActivityBuilder

The Activities feature provides a builder object to your Actions when an NSUserActivity is created for them. We added a persistentIdentifier property, so you can specify this so that you can later delete NSUserActivity insttances registered with the system, for example when previous activities registered for .prediction with Siri relate to a document or resource that is no longer available or relevant.

This is required to expire suggestions Siri would otherwise make for you. You’ll need to explicitly call the delete functions on NSUserActivity.

All the API and guide documentation has been updated at, as has the Flint Demo project which now supports adding voice shortcuts to open specific notes.

What’s new in Flint ea-1.0.4

New Siri Shortcuts support for actions using NSUserActivity

URL Mapping bug fixes in Flint ea-1.0.6

Ooops. Now 100% better URL mapping.