Exclusive new data reveals that content debt costs $4.63 trillion globally. Read the full report and calculate your company's content debt now.

First-Party Native Mobile Development: Storyblok SDKs for Android and Apple Devices

Storyblok is the first headless CMS that works for developers & marketers alike.

Earlier this year, we announced a pair of native API clients for Swift and Kotlin, which provided the means for utilizing Storyblok’s Content Delivery and Management APIs on mobile devices, opening the door to even more ways to develop with Storyblok.

Our team has been hard at work in the months since, and we're proud to announce the release of our very first SDKs for native mobile development: an Android SDK built for Jetpack Compose and an Apple SDK built for SwiftUI.

With these new SDKs, custom-built API integrations and rendering layers are no longer necessary thanks to the feature set included in these packages, and even offline navigation and caching are handled by default, allowing for a more stable and predictable user experience.

Fetching and rendering stories

Once the project has been created and the appropriate SDK and dependencies have been added, stories can be fetched through the addition of a function as shown in the examples below.

For Android devices

After defining your components and creating a Blok provider, wrap your content in the Storyblok composable:

Storyblok(
    accessToken = "YOUR_ACCESS_TOKEN",
    version = Draft,
    blokProvider = myBlokProvider
) {
    val story by story<Page>("home").collectAsState(null)
    
    story?.let { Blok(it.content) }
}

For Apple devices

After describing your space’s components as a BlockLibrary, create a StoryblokClient generic over it:

let client = StoryblokClient(
    library: Content.self,
    accessToken: "YOUR_ACCESS_TOKEN",
    version: .draft
)

let story: Story<Content>? = try await client.story("articles/hello-world")
    .values
    .first { _ in true }

The SDKs serve up cached content right away while attempting to connect to a network to retrieve fresh data. Because content is cached upon retrieval, navigation through previously viewed content is possible even without an active network connection, and continue to function until network connectivity is restored.

Learn:

For more detailed information on fetching and rendering stories, read the Android and Apple guides.

Notably, the SDKs also support rich text node types by way of the Storyblok Material 3 library for Android and the RichTextView library for Apple.

Further development and customization

Our Android and Apple guides are an invaluable resource for not only developing with the feature set of these SDKs, but also learning best practices in conjunction with them to implement common mobile UX functionality.

For instance, dynamic navigation is possible for both Android and Apple devices, integrating with the back stack or navigation stack and allowing users to tap or swipe to open links and navigate forward and backward through a Storyblok space.

Additionally, changing the build configuration allows for a visual preview, which provides a way to view draft content in the debug build of an Android or Apple app.

The guides also showcase how to create field-level translations, switching languages to localize content either automatically based on the viewer’s device locale or as triggered manually from an in-app selector by the user.

What’s next

Both the Android and Apple SDKs are early releases (0.4.0 and 0.3.0 respectively), so the packages may change over time based on usage and community feedback. We encourage you to experiment with these new SDKs, and share any issues or feedback you have to the Swift and Kotlin library repositories, or the community channel of the Storyblok Discord server.