Working on a little project: creating a generic html5 based magazine library/reader solution for the ipad.
Basic idea is that present publishing solutions (i.e. Adobe’s stuff that Conde Nast is using) is too expensive for a broad range of (smaller) publishers. Furthermore, those publishing solutions do not leverage present web technology (html5), but are stemming from a DTP heritage.
I believe that the iPad is a great device for magazines – especially if these magazines have rich, interactive content. Makes a lot of sense to use technology that’s made for that.
Creating an app that allows you to ‘manage’ multiple issues, off-line reading and has this snappy performance is not easy.
Pic: the library view: each issue is shown with its cover, a title, a description and a download/archive button. Once an issue is downloaded, you can read it when you click on the cover. You can swipe (left – right) through all the issues in the library. The sync button on the bottom left contacts the server, checks if there are new issues and refreshes the library.
If you wanna play with it – here are the sources.
Just to talk you through:
- siteless magazine is the project name and it takes graphics and stuff from this site for testing purposes
- minizip for unzipping
- json for json parsing
- pugpig reader (has nice prerendering snapshots)
- LibraryViewController – this is where the main stuff is happening. note that covers are referenced by url in the json string and resolved afterwards. Besides the syncing functionality (button bottom left), it also takes care of the instantiation of issueviewcontroller objects and doing layout management
- IssueViewController – this is the viewcontroller of a single issue. Design (xib) is still crap and will be updated. Also takes care of downloading/unzipping of a single issue and archiving (which removes the issue from filesystem)
- ReaderViewController – takes care of the actual reader – uses the pigpug framework for now.
its a mixed storage model:
- issues are stored using core data (sqlite database). You can inspect the database using sqlite database browser. As you can see, the database is not included – it is created automatically if it does not exist.
- cover graphics are stored on the filesystem — the location of the cover on the filesystem is persisted in the database. It’s a full path – i havent run into problems with it.
- issues (dossiers) are stored on the filessystem. The ‘archive’ operation removes it, the ‘download’ downloads it, unzippes it and persists the reference to it in the database.
the datamodel is in the xcdatamodel file. The classes Issue, Cover and Content are generated from that datamodel. It puzzles me why it doesnt generate the correct typing for the references (which explains some casting in the code), i left it because then its easy to regenerate the classes after a change of the model.
to check out what’s happening, it’s easy to monitor the folder and database that sits in there. Starting over is also easy: remove everything that sits in that folder (/’user’/Application Support/iPhone Simulator/4.3.2/Applications/’applicationid’/Documents/)
the json format is easy to understand, make sure the issue numbers are unique. On my site, there are two testissue included – (issue number 1 and 2, from Laker and Pigpug). the others do not exist.
- integration of the reader. The reader does not yet allow for vertical scrolling. The double tap shows the index. And yes, the library button needs work. Does not refresh if you want to open another issue (still in progress)
- refactoring of some methods (some are too long and windy)
- generalize the code/naming and include it in the github (after testing)
all feedback / issue reports is appreciated!