Document-Based Apps Tutorial: Getting Started

In this document-based app tutorial, you will explore how you can save and open custom documents and interact with the Files app. By Warren Burton.

Leave a rating/review
Download materials
Save for later
Share
You are currently viewing page 5 of 5 of this article. Click here to view the first page.

Linking the Framework

The last thing to do is to link the MarkupFramework to the extension:

link framework target

  1. Expand the Products folder in the Project navigator.
  2. Select MarkupFramework.framework.
  3. Add a check to MarkupThumbnail in the Target Membership of the file inspector.

You may need to set your run target back to Markup after adding the Thumbnail Provider extension.

Build and run. Wait a few seconds for the extension to boot and do its work. The icons should turn into baby representations of the content:

browser thumbnails

Pretty cool, right?

Where to Go From Here?

Congratulations! You have built a document-based app using the system file browser. You can find a reference finished project via the Download Materials link at the top or bottom of this tutorial.

In this tutorial, you’ve learned how to:

  • Create a UIDocument subclass.
  • Configure file properties and UTI’s.
  • Interact with the system file browser component.
  • Handle interactions with other apps.
  • Supply a dynamically generated icon.

The advantage of this component is that everyone who uses this interface will recognize it as a file system. You can share these documents and put them on your iCloud drive for editing on any of your devices. If you’re upgrading an existing code base, and can drop iOS 10 support, now might be a good time to delete some code and replace it with this component.

Some areas for further research:

I look forward to hearing about your adventures with UIDocumentBrowserViewController and its friends in the forum below!