The initial phase involves the creation of an Action extension named “Change it Up” designed to display the text content of host apps in upper case and using a larger font so that it is easier to read. The tutorial in the remainder of this and the next chapter is divided into two distinct phases. The full book contains 93 chapters and 760 pages of in-depth information. You are reading a sample chapter from iOS 16 App Development Essentials.īuy the full book now in eBook or Print format. Both concepts will be implemented in the remainder of this chapter and the next chapter by creating an example Action extension and host app. With the appropriate behavior implemented, a host app can receive modified content from an Action extension and constructively use it on the user’s behalf. The other possibility is for host apps to be able to move beyond simply displaying the Action extension as an option within the action view controller. An Action extension must be bundled with a containing app which must, in turn, provide some useful and meaningful functionality to the user. In the first instance, there is the Action extension itself. Unlike other extension types, there are two sides to an Action extension. In other words, an Action extension that can only work with text-based content will not appear as an option in the action view controller when the user is working with or viewing image or video content within a host app. The appearance or otherwise of the Action extension within the action view controller is entirely context-sensitive. When an Action extension is created, it must declare the types of content with which it can work. Action extensions appear within the action area of this panel alongside the built-in actions such as printing and copying of content. Figure 77-1, for example, shows the action view controller panel as it appears from within the Safari web browser running on an iPhone. An Overview of Action ExtensionsĪction extensions appear within the action view controller, which is the panel that appears when the user taps the Share button within a running app. This chapter will introduce the concept of Action extensions in greater detail and put theory into practice by creating an example app and Action extension. An app designed to translate text into different languages might, for example, provide an extension to allow the content of other apps to be similarly translated. In the case of Action extensions, this functionality must generally fit the narrow definition of enabling the user to transform the content within a host app or view it differently. You will see a few things that are unusual in this code compared to standard Swift code, but thanks to Apple’s work on interoperability with Objective-C, it works just fine.As with other extension types, the Action extension aims to extend elements of functionality from one app so that it is available for use within other apps. Not a lot has changed about it between iOS 7 and iOS 9. UIActivityViewController is an Objective-C API. Today though, we are just going to cover the built in aspects of using UIActivityViewController in your Swift app. If you’ve paid any attention to WWDC a few years, you have probably saw that this is the new home for Share and Action extensions. I think I originally started with “share sheet” and went on from there, so it may seem silly to point out something so obvious, but when I first tried, I knew what I wanted, I just had no idea what it was called. When I first learned about it, I didn’t even know what to search for. That interface is known as the UIActivityViewController. In several iOS apps, such as Safari or the Camera app, you can click a button that brings up an interface that makes it easy to send or share what you are looking at via messages, Twitter, Facebook, etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |