SDK overviewAndroidiOSDemoChangelog

Getting started on iOS

IOS SDK uses the SwiftUI API for UI rendering, networking is handled by Kotlin Multiplatform Mobile and this part of the SDK is same for Android and iOS. You can check external dependencies for this module here. Our tests show that SDK will increase your app approximately by 6MB in download size and 18MB in install size.

The Dateio SDK for iOS is supported from system version 14.0.

However, technically it should be possible to use even 13.0. Older versions are not supported due to technical restrictions.

Components can be easily integrated into the UIKit framework via UIHostingControllers.

Adding SDK to project

The SDK can be added into your project manually or by Cocoapods / Swift Package Manager.

CocoaPods / Swift Package Manager integration

Dateio does not provide public access to its repository. To integrate using CocoaPods or Swift Package Manager, you must either use your private server (repository) or create a local package.

More detailed information can be found here:

Manual integration

The SDK is delivered in two files (DateioSDKiOS.xcframework, DateioSDKShared.xcframework). These files have to be added to the Xcode project. Don't forget to check the box Destination: Copy items if needed.

Getting startedDemo code

Next step is Embed and sign the SDK framework. Go to the Targets and click on desired project target and on tab General.

Demo general

Find section Frameworks, Libraries, and Embedded Content, click on the DateioSDKiOS.xcframework and choose Embed & Sign in the dropdown menu. Click on the DateioSDKShared.framework and choose Embed & Sign in the dropdown menu.

Demo frameworks

Now, the FRAMEWORK_SEARCH_PATHS in build settings have to be updated. So go to the Targets and click on desired project target and on tab Build Settings. Search for parameter FRAMEWORK_SEARCH_PATHS and add path to directory where xcframeworks are located in the project.

Demo search paths

The SDK can now be used in the project.

Adding screens to app

Usage of SDK UI components or views is pretty easy. Just import the SDK and use the specific component.

UIKit example

In the UIKit framework, the SwiftUI component from the SDK is wrapped into the UIHostingController and can be used directly.

import UIKit
import DateioSDKiOS

final class ViewController: UIViewController {
    @IBOutlet private weak var infoLabel: UILabel!
    @IBOutlet private weak var tableView: UITableView!

    private var mainScene: MainScene?

    override func viewDidLoad() {
        super.viewDidLoad()

        title = "UIKit Demo"
        navigationController?.navigationBar.tintColor = UIColor.white
        mainScene = MainScene(navigationController: navigationController ?? UINavigationController())
    }
}

extension ViewController: UITableViewDelegate, UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        1
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell")
        cell?.textLabel?.text = "SDK Landing page"

        return cell ?? UITableViewCell()
    }


    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        // Pushes SDK landing page into the navigation stack
        mainScene?.showOverviewView()
    }
}

Code above will render the same view as in the SwiftUI example below.

UIKit example in Tabbar

Example of using the SDK landing screen as a standalone view in UITabBarController in storyboard:

UITabBarController in a storyboard

Example of InTabController:

import UIKit
import DateioSDKiOS
import DateioSDKShared

final class InTabController: UIViewController {
    private var mainScene: MainScene?

    // MARK: View life cycle
    override func viewDidLoad() {
        super.viewDidLoad()
        
        mainScene = MainScene(navigationController: navigationController ?? UINavigationController())
        
        guard let mainScene else { return }
        mainScene.showInTabView()
    }
}

First, the main scene is initialized here, where the UINavigationController is passed. Then the mainScene.showInTabView() function is called to set and insert the SDK landing view into the passed UINavigationController. In order not to display the custom back button in the navigation bar, it is necessary to set the value of var dateio_navigation_back_on_hp: Bool {get} to false (within the DateioSdkNavigationBarConfiguration configuration protocol implementation).

SwiftUI example

import SwiftUI
import DateioSDKiOS

struct MainView: View {
    private var mainScene: MainScene?

    // MARK: - Init

    init(mainScene: MainScene?) {
        self.mainScene = mainScene
    }

    // MARK: - Body

    var body: some View {
        mainScene.view
    }
}

This code will render main landing screen (ScrollView with the SDK offers and search UI. The SDK loads data from API, renders UI including details and handles actions).

Where to head next

By this point, you will be able to run application and navigate into screens within SDK. Yet, it won't load any data. In next chapters you will find how to resolve this and how to customize your UI.