Nerd For Tech
Published in

Nerd For Tech

Notion Database + iOS

I came up with an interesting topic. Now, we can integrate Notion Database into to an iOS App. Notion had wonderful docs for getting started Notion APIs integration across all platforms. Every Notion APIs are in beta stage. So, I just planned to explore what it is. I’m not gonna explain you in details. Please refer here.

Notion + iOS

In this tutorial, we are going to the list the notion database’s value into an iOS app. Hope everyone have your own notion’s workspace. If you don’t have, please create it from here.

we are going to focus on followings:

  1. Notion Integrations
  2. Notion DB creation
  3. Share Notion DB to Integration
  4. Notion API SDK for iOS
  5. Sample iOS App

Notion Integrations :

Integration is nothing but the place where we get our secret token to access the Notion API , Database, Pages, etc.

First, we need to create notion integrations. There are two types of integrations:

  1. Internal — Used for single workspace
  2. Public — User for multiple workspace using OAuth

Now, we only focus on Internal Integration creation. You can create your inegration from here by entering Name, Logo and workspace and then tap submit.

Now Integration creation is done. It will look like this.

Integrations

Notion DB creation :

Create new page and named as “iNotionDB”. Inside the page, you need to create Database — Table-Inline.

Create your database

I’ve added some sample data which have list of hot drinks.

Add data into the table

Share Notion DB to Integration:

To share Notion DB, tap on the share icon at top right corner, then tap on the invite button. There you can see your integration. Select that and tap on the invite button. Finally, you have added your integration for the database.

Notion API SDK for iOS :

You can download the Notion API SDK for iOS from here and add it into your xcode project. Or else, you can install it from the pod.

pod 'NotionClient', '0.0.1'

Now, SDK is added to your xcode project. I’m using the following notion API to fetch my database values.

let client = NotionClient.init(token: "NOTION_INTEGRATION_SECRET_TOKEN")client.queryDatabase(withId: "NOTION_DATABASE_ID") { (data, error) inprint(data)}

To collect “NOTION_INTEGRATION_SECRET_TOKEN”, you need to check the integration’s settings that you have created in the first step.

You see the Notion database ID by ,

Go to the Notion DB -> Tap on the Open as page -> Check the URL

https://www.notion.so/NOTION-DATABASE-ID?v=randomid

In the Notion Client API response, you will get your database values.

That’s all, everything is ready to build our app 💪.

Sample iOS App:

You can check the entire work in my github repo.

Note : All Notion APIs are in beta stage. Current Notion API iOS SDK had only API for fetching database page lists only. I need to add page details in the app. I locally handled the images for pages list. I’m planning to continue this in my next post. Stay tuned! Cheers 🍻

Follow me : LinkenIN

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ashok

Ashok

 iOS and Flutter developer @TCS, Chennai. Here to share best practices learned through my experience. Reach me on www.linkedin.com/in/ashok1208