iOS SDK Sample App import XCFramework

Before starting this, please check iOS SDK Development Build XCFramework and iOS SDK Deploy Github XCFramework.

Now, we have iOSModuleSDK.framework.

We want to test this framework couple of ways.

  • Import direct
  • CocoaPods
  • Carthage
  • Swiftpackage

So, I prepared test sample app to test one by one in a same repository.

If you want to check source codes, please take a look iOSMobileSDKApp.

This repository has 4 branches to support above

Branch nameDescription
masterImport direct
feature/podsCocoaPods support
feature/carthageCarthage support
feature/swiftpackageSwiftpackage support
スポンサーリンク

Direct import

Let’s try simple way to do.

Direct import is just copy XCframework and add dependency.

Goes to App target and select “Build Phases”.

Link Binary With Libraries and add xcframework.

Now, it’s ready to use

Sample Codes

The Sample app is very simple. This is not Sandbox app, independent from SDK codes.

Create app with Swift UI and call SDK codes

ContentView.swift

import SwiftUI
import iOSMobileSDK

struct ContentView: View {
    var body: some View {
        Text(SDKModule.init().hello())
            .padding()
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

This is almost default Swift UI codes automatically generated by XCode.

I added import Module and use SDK Codes.

If you need to take a look SDK code, please check iOS SDK Development SDK Code.

If you run this app,

You can see this from Simulator!

It works.

iOS
スポンサーリンク
Professional Programmer2

コメント