Richie
@MainActor
public final class Richie
Richie is the main entry point to the Richie SDK.
Use Richie to construct the top-level SDK objects for ads, books and editions. You can use the
shared property if you prefer a singleton, or just pass around an instance. Richie stores
the objects you create, so that the first call to makeX creates the X, and subsequent calls
return the same object.
Warning
Do not construct multiple Richie instances at the same time. They use the same
resources on disk and will interfere with each other.
If you recreate the Richie instance during the life of your application, call invalidate
on the old instance before its deallocated. This will also invalidate all objects created
by that factory instance, and their behavior after that is undefined.
-
Initialize the
sharedsingleton instance.Call this method before accessing the shared instance.
Important
This method must not be called multiple times.
Declaration
Swift
@MainActor public static func initializeShared( richieAppID: String )Parameters
richieAppIDAn identifier for finding the configuration for the SDK. This can be the bundle ID, Richie app ID, or anything else agreed to with Richie, as long as it can be used to successfully to find a configuration in the Richie configuration service.
-
Undocumented
Declaration
Swift
@MainActor public static func initializeShared( appIdentifier: String ) -
Access a singleton instance.
Important
You must call
initializeShared(appIdentifier:)before accessing this property.Declaration
Swift
@MainActor public static var shared: Richie { get } -
Initialize
Richiewith application identifier.If you manage the lifetime of
Richieinstances yourself by calling this method instead of usingshared, you should callinvalidatebefore releasing the last reference. This will also invalidate all objects created by the factory, and their behavior after that is undefined.Declaration
Swift
@MainActor public init( richieAppID: String )Parameters
richieAppIDThe identifier that should be used to find configuration for the app. This can be the bundle ID, Richie app ID, or anything else agreed to with Richie, as long as it can be used to successfully to find a configuration in the Richie configuration service.
-
Undocumented
Declaration
Swift
@MainActor public convenience init( appIdentifier: String ) -
makeAds()AsynchronousMake a
RichieAdsControllerinstance or return a previously constructed one.Declaration
Swift
@MainActor public func makeAds() async throws -> RichieAdsController -
makeEditions(analyticsListener:AsynchronoustokenProvider: ) Make an
Editionsinstance or return a previously constructed one.Declaration
Swift
@MainActor public func makeEditions( analyticsListener: (any AnalyticsListener)?, tokenProvider: any TokenProvider ) async throws -> Editions -
makeBooks(analyticsListener:AsynchronousarticleOpener: audioPlaybackController: backgroundTaskSource: bookCoverOverlayProvider: bookOpening: booksFeedSortingType: booksLibraryAnalyticsLoggerCallback: booksLibraryHostAppConfigDataCallback: booksLibraryNavigationDelegate: categoriesCompositionEnabled: categoryListIconProvider: credentialsExchangerCallback: displayConfigProvider: enabledTabs: htmlToAttributedStringConverter: libraryRootDirectory: locale: miniplayerProvider: myBooksFilterItems: readingListHost: searchResultsProviderType: settingsViewControllerProvider: shouldImportLocalBooksToReadingList: stringProvider: tabBarStyle: tokenProvider: topBarProvider: uiReadyCallback: window: ) Make a
BooksLibraryControllerinstance or return a previously constructed one.Declaration
Swift
@MainActor func makeBooks( analyticsListener: (any AnalyticsListener)? = nil, articleOpener: ArticleOpener?, audioPlaybackController: AudioPlaybackController? = nil, backgroundTaskSource: RichieBackgroundTaskSource? = nil, bookCoverOverlayProvider: BookCoverOverlayProvider?, bookOpening: BookOpening, booksFeedSortingType: BooksFeedSortingType = .alphabetically, booksLibraryAnalyticsLoggerCallback: BooksLibraryController.BooksLibraryAnalyticsLoggerCallback? = nil, booksLibraryHostAppConfigDataCallback: ((Data) -> Void)? = nil, booksLibraryNavigationDelegate: BooksLibraryNavigationDelegate?, categoriesCompositionEnabled: Bool = true, categoryListIconProvider: CategoryListIconProvider? = nil, credentialsExchangerCallback: ((CredentialsExchanging) -> Void)? = nil, displayConfigProvider: BooksDisplayConfigProvider, enabledTabs: [LibraryTab], htmlToAttributedStringConverter: BooksHTMLToAttributedStringConverter? = nil, libraryRootDirectory: String? = nil, locale: Locale = Locale.autoupdatingCurrent, miniplayerProvider: MiniplayerProvider? = nil, myBooksFilterItems: [BooksFilterItem]? = nil, readingListHost: ReadingListHost?, searchResultsProviderType: SearchResultsProviderType = .regular, settingsViewControllerProvider: ViewControllerProvider? = nil, shouldImportLocalBooksToReadingList: Bool = false, stringProvider: UserVisibleStringProvider?, tabBarStyle: BooksLibraryTabBarStyle = .custom, tokenProvider: TokenProvider, topBarProvider: TopBarProvider? = nil, uiReadyCallback: (() -> Void)? = nil, window: UIWindow? = nil ) async throws -> BooksLibraryController