iOS SDK Development SDK Code


Let’s create SDK

Let’s start SDK development.

This is environment.

  • Mac OS Monterey
  • XCode 13.3.1
  • Deployment Target iOS 15.2
  • Mac Mini M1 Chip


This is SDK development step

  1. Create a project from XCode
  2. Create App + SDK module structure
  3. Write SDK codes
  4. Write Unit Tests
  5. With a Sandbox Application
  6. Build Framework and Run Sandbox Application
  7. Build Documentation(Out of scope)
  8. Deploy (Out of scope)
  9. Test from different Application (Out of scope)

Will explain from 1 to 6, 7 to 9 are different blog to explain

Create a project from XCode

Create a project from XCode.

This is same as general application project.

Choose Framework from the list.

Check “Include Documentation”

Create App + SDK module structure

Before starting codes, let’s add 1 target to test functions from the app.

Go to Project and press “+” button to add new TARGETS.

You can see + button at the bottom of TARGETS

And select App

Select App to add new App Target.

After this, Go to “Build Phases” / “Link Binary With Libraries” and press “+” button.
We can select iOSMobileSDK from selection (Target is in this project)

O.K. Now, iOSMobile SDK framework is imported in SandboxApp target.

Write SDK codes

We call this app as Sandbox Application. Sandbox Application is to check usage and interface before release/deploy.

We can know the public and name, how to use from actual application, so it’s important.

We call other project application to test import after deploy as Sample Application.

Sandbox is first test target for SDK


open class SDKModule: NSObject {
    @objc public func hello() -> String {
        return "Hello!"

This is a simple code, one class and one public method.That’s it for SDK codes.

Write Unit Tests

Next is to write Unit Tests.

This is not directly related with SDK, but to separate next Sandbox application test, I explain

Unit Test is also important for SDK development same as Application.
To logic test, and regression for change,…

The purpose is same as app development.


import XCTest
@testable import iOSMobileSDK

class iOSMobileSDKTests: XCTestCase {

    override func setUpWithError() throws {
        // Put setup code here. This method is called before the invocation of each test method in the class.

    override func tearDownWithError() throws {
        // Put teardown code here. This method is called after the invocation of each test method in the class.

    func testExample() throws {
        XCTAssertEqual("Hello!", SDKModule().hello())

    func testPerformanceExample() throws {
        // This is an example of a performance test case.
        self.measure {
            // Put the code you want to measure the time of here.


This test codes to test SDKModule method.

Run Unit Test

With a Sandbox Application

After checking Unit Test, let’s use SDK codes from App.

This is important phase, because sometimes, we noticed that wrong interface.

For example, public level, method name, arguments, class, etc…, we try to use SDK from developer point of view


Use methods from Swift UI View code.

import SwiftUI
import iOSMobileSDK

struct ContentView: View {
    var body: some View {

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {

Import iOSMobileSDK and use SDKModule class and call method.

Build Framework and Run Sandbox Application

Now, first SDK is ready to use, let’s build SDK.

Build is very simple, change build target to iOSModuleSDK framework at the top of XCode

And Press build button

The framework is under /Library/Developer/Xcode/DerivedData/iOSMobileSDK-xxxxxxxxx/Build/Products/Debug-iphoneos/iOSMobileSDK.framework

xxxxxxxxx is random string assigned when we build.

Next is run this from the app.

We already made a link from dependency setting from XCode. So, we can build and test from Sandbox Application.

Change target from framework to app, and press build and run

Now, we can see simulator with following display

Professional Programmer2