RichieBooksLibrary

Objective-C

@interface RichieBooksLibrary : NSObject

Swift

class RichieBooksLibrary : NSObject

RichieBooksLibrary manages a set of books on the local file system.

InitializingLibraryFromDisk

  • Migrate books from standard Library/Caches to Library.

    Declaration

    Objective-C

    - (void)migrateBooksWithCompletion:(nullable void (^)(BOOL))completion;

    Swift

    func migrateBooks() async -> Bool
  • Before trying to create new books or see what other books exit, existing books must be loaded from disk. It’s a programmer error to try to modify the library before loading has been done.

    Declaration

    Objective-C

    - (void)startLoadingBooks;

    Swift

    func startLoadingBooks()
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL hasLoadedBooks

    Swift

    var hasLoadedBooks: Bool { get }

BookManagement

  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, nullable, readonly) NSArray<RichieBooksBook *> *books

    Swift

    var books: [RichieBooksBook]? { get }
  • Undocumented

    Declaration

    Objective-C

    -(nullable RichieBooksBook *) createBookWithGuid:(nonnull MaggioGuid *)guid;

    Swift

    func createBook(with guid: MaggioGuid) -> RichieBooksBook?
  • Undocumented

    Declaration

    Objective-C

    -(void) updateBook:(nonnull RichieBooksBook *)book;

    Swift

    func updateBook(_ book: RichieBooksBook)
  • Note

    Do not delete a book that is presented to the user for reading.

    After deleting the book, the instance is invalid and it’s a programmer error to use it.

    Declaration

    Objective-C

    - (void)deleteBook:(nonnull RichieBooksBook *)book;

    Swift

    func deleteBook(_ book: RichieBooksBook)
  • Undocumented

    Declaration

    Objective-C

    -(void) deleteBooksWithIds:(nonnull NSSet <NSString *> *)bookIds;

    Swift

    func deleteBooks(withIds bookIds: Set<String>)
  • Undocumented

    Declaration

    Objective-C

    -(BOOL) bookRequiresEntryDownload:(nonnull NSString *)bookId version:(NSInteger)version;

    Swift

    func bookRequiresEntryDownload(_ bookId: String, version: Int) -> Bool