Adding Services

Each app can provide application-specific services by subclassing the UIActivity class and passing that activity to the UIActivityController on initialization. These custom activities are available in the presented activity view controller alongside the system-provided activities. When selected, the custom activity presents a view controller allowing the user to interact with the passed data or service in some way, such as entering credentials or manipulating the data.

Listing 11-1 introduces a skeletal UIActivity subclass that presents a simple text view. This custom activity is shown in Figure 11-5 as the List Items (Cookbook) option. When this icon is tapped, a custom view controller is presented, displaying a view that lists ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.