A data type is a whole series of logic and assets in The Shelf that determines how a piece of data is imported, stored, displayed, and exported. As an example, the Image data type:
- imports the image data
- Checks if there is a URL of the image available too
- Stores the image in an appropriate manner
- Displays the image in the cell with the orange photos style badge on it
- Allows the image to be previewed
- Enables the image and available URL to be exported.
How it works?
When something is dropped into The Shelf, iOS tells The Shelf what type of data is available form the drop. For example, when an text extract is dropped from Safari, the following representations are available:
- Apple Web Archive Type
- Attributed String
- Rich Text
- Plain Text
These are ordered in degrading fidelity, where the top one is the most representative. From this, The Shelf decides which data type is most suitable to store this data for later. The Shelf, then stores the data as that data type and displays it on screen.
Adding new data types
As more apps support drag and drop, The Shelf will need to be updated to add support for these new types. For example, if a contact card is dropped into The Shelf today, it will just store the text representation of it, as that is all The Shelf knows how to handle. However, with a day or two of work The Shelf can be updated to support contact cards, this will involve:
- Identifying suitably high fidelity version of the card to import
- Identify alternate representations that may be useful to the user1
- Implementing the logic to extract the correct data from the drop
- Implementing the logic to store the data in the app
- Designing and creating a badge icon to display in the UI
- Designing and creating the Cell UI to display the item on the shelf
- Designing and creating the Preview UI see the item
- Implementing the logic to export the data when needed
Requesting data types
Once I have a bunch of request, I make it public which type are the most requested and what order I plan to add them. Based on the number of subscribers, I will be adding up to 3 new data types each month.