How to have both Swift 2 and Swift 3 books in iBooks library

booksswift

I'm a professional software developer who is still supporting clients using Swift 2. However, I'd like to be getting up to speed on Swift 3 since clearly it is the wave of the future.

My copy of iBooks (on my Mac, dunno about my iOS devices) is currently the Swift 2 book, and when I go to the bookstore, it shows the Swift 3 version with a read button. When I click that it opens the Swift 2 book.

I see from another question that I can right-click on my Swift 2 book in iBooks, delete it, and then re-download from the app store in order to update to the Swift 3 book.

However, I need both versions to show up in my library, clearly named, and need to be able to open one or the other at will.

How do I accomplish this?

Best Answer

I’m not sure iBooks offers an easy way to keep two versions of the same book from the iBooks Store around.

You could instead add the old version as an ePub or PDF copy. Apple makes the Swift documentation available as an ePub on swift.org. That site only seems to have the latest version, but copies of the older versions can be found around the web. Here's one for example: “The Swift Programming Language, Swift 2.2 Edition, Prerelease”.

There’s also a blog post on “Converting the Swift Programming Language to PDF” which offers these instructions for converting the iBooks Store file to a PDF yourself:

  1. Go to ~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books.
  2. Once there, locate the 881256329 epub folder. You must use a non-beta version of the book. Beta versions are DRM’ed. If your version appears to be DRM’ed (a holdover from the beta period), delete it in iBooks and re-download.
  3. Copy this epub folder to your desktop. Remove the epub extension, zip it, rename to epub. Apple uses a non-standard epub format, and these steps transform the book back to something Calibre can import and convert.
  4. Drag this epub into Calibre.
  5. Click Convert books, choose PDF.
  6. In Page Setup, select default output profile, set margins to 72 on each side
  7. In PDF Output, add printable TOC.
  8. Click OK and let the conversion start