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
shared
singleton 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( 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
Richie
with application identifier.If you manage the lifetime of
Richie
instances yourself by calling this method instead of usingshared
, you should callinvalidate
before 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( appIdentifier: String )
-
makeAds()
AsynchronousMake a
RichieAdsController
instance or return a previously constructed one.Declaration
Swift
@MainActor public func makeAds() async throws -> RichieAdsController
-
makeEditions(analyticsListener:
AsynchronoustokenProvider: ) Make an
Editions
instance or return a previously constructed one.The
Editions
object returned by this method has been initialized, so you do not need to callinitialize()
on it.Declaration
Swift
@MainActor public func makeEditions( analyticsListener: (any AnalyticsListener)?, tokenProvider: any TokenProvider ) async throws -> Editions
-
makeBooks(analyticsListener:
AsynchronousarticleOpener: audioPlaybackController: bookCoverOverlayProvider: bookOpening: booksLibraryNavigationDelegate: displayConfigProvider: enabledTabs: htmlToAttributedStringConverter: miniplayerProvider: readingListHost: stringProvider: tokenProvider: topBarProvider: ) Make a
BooksLibraryController
instance or return a previously constructed one.Declaration
Swift
@MainActor func makeBooks( analyticsListener: (any AnalyticsListener)? = nil, articleOpener: ArticleOpener?, audioPlaybackController: AudioPlaybackController? = nil, bookCoverOverlayProvider: BookCoverOverlayProvider?, bookOpening: BookOpening, booksLibraryNavigationDelegate: BooksLibraryNavigationDelegate?, displayConfigProvider: BooksDisplayConfigProvider, enabledTabs: [LibraryTab], htmlToAttributedStringConverter: BooksHTMLToAttributedStringConverter? = nil, miniplayerProvider: MiniplayerProvider? = nil, readingListHost: ReadingListHost?, stringProvider: UserVisibleStringProvider?, tokenProvider: TokenProvider, topBarProvider: TopBarProvider? = nil ) async throws -> BooksLibraryController