Pages: [1]   Go Down
  Print  
Author Topic: Action extensions in iOS 8: Explained  (Read 613 times)
HCK
Global Moderator
Hero Member
*****
Posts: 79425



« on: July 04, 2014, 09:00:37 am »

Action extensions in iOS 8: Explained

<div class="field field-name-body field-type-text-with-summary field-label-hidden"><div class="field-items"><div class="field-item even" property="content:encoded"><p><a href='http://www.imore.com/action-extensions-ios-8-explained' title="Action extensions in iOS 8: Explained"><img src='http://www.imore.com/sites/imore.com/files/styles/large/public/field/image/2014/07/wwdc_2014_action_extension_icon.jpg?itok=U6keYq2Q' />[/url]</p> <p>Share Sheets in iOS have another name behind the scenes — activity view controllers. That's fitting because, in addition to providing sharing options, they also provide for other "activities", like action options. Traditionally, that's been system options such as copy, save, print, etc. However, just like custom sharing options have now been made available in <a href="http://www.imore.com/ios-8" title="iOS 8 help, how-to, news, reviews">iOS 8[/url], so too have custom action options. They're part of the new Extensibility feature set, one of the most important additions to iOS since the advent of the App Store. Extensibility enables Widgets, custom keyboards, and so much more, including custom action extensions. So, how do action extensions work?<!--break--></p> <h2>Action packed</h2> <p><a href='http://www.imore.com/action-extensions-ios-8-explained' title="Action extensions in iOS 8: Explained"><img src='http://www.imore.com/sites/imore.com/files/styles/large/public/field/image/2014/07/action_option_evolution_screens.jpg?itok=DGdP3SV2' />[/url]</p> <p>Action options first came to iOS as part of the same drab lists that contained share options. Not only did that fail to provide a lot of visual distinction, it didn't scale.</p> <p>When share options moved to the grid-like Share Sheets in iOS 6, actions joined them. There, share options got the full color icons of the apps with which they were associated, and action options got custom, grayscale icons that indicated their function — save to Camera Roll, print to AirPrint, copy to clipboard, etc. Share and action options still ran together, however, and the grid scaled only slightly better than the list.</p> <p>With iOS 7, Share Sheets got a new look and feel to match Apple's new design language, and actions switched from being grayscale to black and white. Moreover, actions got their own distinct row along with horizontal scrolling to fit in as many as needed. However, there were still only a very few action options, and only the ones that matched services Apple provided.</p> <p>iOS 8 changes that.</p> <h2>How action extensions work</h2> <p><a href='http://www.imore.com/action-extensions-ios-8-explained' title="Action extensions in iOS 8: Explained"><img src='http://www.imore.com/sites/imore.com/files/styles/large/public/field/image/2014/07/wwdc_2014_action_extension_bing.jpg?itok=N5KCq-yW' />[/url]</p> <p>Extensibility in iOS 8 means that we're not longer bound to action options supported by Apple and Apple alone. We no longer have to wait for things like AirPlay and AirPrint to be rolled out, or wonder if Apple will ever add system-wide support for someone else's product or service. Now any app can add an action extension that increases the utility and diversity of other apps and iOS itself.</p> <p>So, instead of Apple and Microsoft making a deal to get Bing translate built into Safari, Microsoft can simple make an action extension to the Bing app and, thanks to Extensibility, it'll be available just like the built in options.</p> <p>Getting to an action extension is simple. If you're in Safari and you're reading iMore, and your native language isn't English but French, you can tap the Share button, scroll horizontally to the Bing Translate extension, and voila, the page would translate-in-place for you.</p> <p>To help keep things manageable, action extensions tell iOS their context — whether they work on text or images, form fields or something else — and iOS will only present that work in that context. So, if you select text, you won't get image action options.</p> <p>You can also arrange action extensions in any order you like. Scroll to the end of the action options on the Share Sheet, tap the More button, and slide any item in the list up or down. Unlike custom share options, however, you can't toggle any of the default system actions off, but you can toggle the action extensions off.</p> <p>Still, that means if you use the 1Password action extension to autofill your passwords all the time, you can put it into one of the first few slots. Then it's always immediately available, no scrolling required, whenever you tap the Share button.</p> <p>Like plugins, action extensions don't just add more apps, they add more functionality to the system and existing apps. Say goodbye to having to leave Safari, go to 1Password, use the in-app browser, or copy the password to the clipboard and find your way back to Safari. With iOS 8, Extensibility, and action extensions, everything just works, right where you need it, right when you need it.</p> <h2>Custom Safari actions</h2> <p><a href='http://www.imore.com/action-extensions-ios-8-explained' title="Action extensions in iOS 8: Explained"><img src='http://www.imore.com/sites/imore.com/files/styles/large/public/field/image/2014/07/wwdc_2014_action_extension_web_japanese.jpg?itok=Qz2R1pbc' />[/url]</p> <p>There's also a special kind of action extension in iOS specifically for Safari. They're called custom Safari actions and they come in two types:</p> <ul><li>Action extensions that present it's own interface</li> <li>Action extensions that presents no interface.</li> </ul><p>An example of an action extension that presents its own interface would be 1Password, which could ask you which of your 3 different Google accounts you want to use to login to YouTube.com.</p> <p>An example of an action extension that currently doesn't present an interface would be Bing Translate, which, as demoed at WWDC, instantly replaces the existing text on a webpage with translated text.</p> <h2>Developing action extensions</h2> <p><a href='http://www.imore.com/action-extensions-ios-8-explained' title="Action extensions in iOS 8: Explained"><img src='http://www.imore.com/sites/imore.com/files/styles/large/public/field/image/2014/07/wwdc_2014_action_extension_web_translated.jpg?itok=WqZOGYJR' />[/url]</p> <p>Activity extensions let developers wrap up a piece of functionality from their app and make it available to iOS and other apps via the built-in Share Sheets.</p> <p>Although extensions are primarily view controller based on iOS, as mentioned above, activity extensions can be view controller based, or for custom Safari extensions, they can have no view.</p> <p>The difference between standard action extensions and custom Safari extensions is that only custom Safari extensions can use JavaScript integration. They get full access to the Document Object Model (DOM) and that means they can, for example, grab an image from a web page, mark it up, and then put the updated version back in place of the original.</p> <p>Like with share extensions, activity extensions have activation rules to tell the system what kinds of data they can manipulate. That way, for example, if a paragraph is selected, only custom actions that can manipulate text are displayed among the options. If a picture is selected, only custom actions that can manipulate images are displayed.</p> <p>Apple has several resources to help developers with action extensions:</p> <ul><li>WWDC 2014 Creating Extensions for iOS and OS X session, Part 2</li> <li>Apple (pre-release) Extensibility documentation</li> </ul><h2>Action extensions and security</h2> <p><a href='http://www.imore.com/action-extensions-ios-8-explained' title="Action extensions in iOS 8: Explained"><img src='http://www.imore.com/sites/imore.com/files/styles/large/public/field/image/2014/06/wwdc_2014_privacy.jpg?itok=ozXpGlSg' />[/url]</p> <p>iOS is a security- and privacy-first operating system. Adding functionality like action extensions is one thing. Adding them while maintaining a high level of security is quite another. With iOS, apps are "sandboxed" so they can only access their own data unless specific, explicit permission is given by the person using them. That's why apps need to request access to the camera roll, or why you have to tap the "Open in..." button. It makes it harder for malicious apps to do ever get onto the system and into your private data.</p> <p>With iOS 8 and Extensibility, Apple keeps an app's extensions inside the app's sandbox, but allows iOS, and other apps by way of iOS, to reach out, request interface, information, and functionality. The container app can then project that interface, information, and functionality back to iOS or the host app right back.</p> <p>For action extensions, the app you're sharing from is the host and the service you're sharing to is the container. For example, if you're in Safari, that the host application. If you're using an action like filling a password from 1Password or translating text from Bing, those would be the containers. Beyond security, that provides reliability — neither 1Password nor Bing in those examples would have to be running in advance, or persisting in the background, for the action extensions to be invoked.</p> <p>When an action extension is called, it communicates securely through iOS to its host app for things like the authentication and password information or the translation libraries. That's then sent back to the container app so the action can complete.</p> <p>Apple hasn't detailed the specifics of how all this works yet, but has said it uses similar security to the rest of iOS. Since iOS 7, Apple has done an incredible job with security and cryptography. I'm willing to bet Extensibility is enjoying something just as well thought out and just as secure.</p> <h2>Bottom line</h2> <p>Activity extensions provide incredible new functionality to iOS 8 and to iOS 8 apps. It's important to remember that this is Extensibility 1.0, and just like multitasking has, Extensibility will no doubt evolve over time. For example, it looks like 1Password can currently only fill passwords in Safari, not in web views or native interfaces in other apps.</p> <p>Regardless, activity extensions mean iPhone and iPad owners will get to spend less time jumping between apps and more time getting things done within the apps they're already using. And that's a huge win.</p> <p>Any apps you're especially interested in getting action extensions for come iOS 8 launch?</p> <ul><li>More of iOS 8: Explained</li> </ul></div></div></div><div id="comment-wrapper-nid-25494"></div><img width='1' height='1' src='http://tipb.com.feedsportal.com/c/33998/f/616881/s/3c240304/sc/4/mf.gif' border='0'/><br clear='all'/>

<a href="http://da.feedsportal.com/r/199107661169/u/49/f/616881/c/33998/s/3c240304/sc/4/rc/1/rc.htm" rel="nofollow"><img src="http://da.feedsportal.com/r/199107661169/u/49/f/616881/c/33998/s/3c240304/sc/4/rc/1/rc.img" border="0"/>[/url]
<a href="http://da.feedsportal.com/r/199107661169/u/49/f/616881/c/33998/s/3c240304/sc/4/rc/2/rc.htm" rel="nofollow"><img src="http://da.feedsportal.com/r/199107661169/u/49/f/616881/c/33998/s/3c240304/sc/4/rc/2/rc.img" border="0"/>[/url]
<a href="http://da.feedsportal.com/r/199107661169/u/49/f/616881/c/33998/s/3c240304/sc/4/rc/3/rc.htm" rel="nofollow"><img src="http://da.feedsportal.com/r/199107661169/u/49/f/616881/c/33998/s/3c240304/sc/4/rc/3/rc.img" border="0"/>[/url]

<img src="[url]http://da.feedsportal.com/r/199107661169/u/49/f/616881/c/33998/s/3c240304/sc/4/a2.img" border="0"/>[/url]<img width="1" height="1" src="http://pi.feedsportal.com/r/199107661169/u/49/f/616881/c/33998/s/3c240304/sc/4/a2t.img" border="0"/><img src="http://feeds.feedburner.com/~r/TheIphoneBlog/~4/1cVOtHD3JYI" height="1" width="1"/>

Source: Action extensions in iOS 8: Explained
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: