DeliteAI iOS SDK¶
To build the DeliteAI iOS SDK locally and run tests, follow these steps:
Running the SDK Locally Through Example App¶
To effectively test and observe the functionalities of the DeliteAI iOS SDK locally, you can utilize the provided DeliteAIExample
application. Follow these detailed steps to get it up and running:
Install Third-Party Binaries: Run the following command to download all the required dependencies:
cd $(git rev-parse --show-toplevel) && ./setup.sh --sdk ios
Build NimbleNet.xcframework: This command requires CMake to be installed on your machine. If you don’t have CMake, you can install it using Homebrew:
brew install cmake
Build the
NimbleNet.xcframework
by running the following command from the project’s root directory:cd $(git rev-parse --show-toplevel) && ./sdks/ios/script/build-deliteAI-static.sh
Install Dependencies via CocoaPods: Run the following commands to fetch all necessary dependencies - including the DeliteAI iOS SDK itself from your local code which will ensure that you’re testing against your current development version.
cd sdks/ios/example pod install
Open the Xcode Workspace: Once the
pod install
command completes successfully, open the generated Xcode workspace file. It’s crucial to open the.xcworkspace
file, not the.xcodeproj
file, to ensure all pods are correctly linked.open DeliteAIExample.xcworkspace
Select the Target: In Xcode, ensure that
DeliteAIExample
is selected as the active target for compilation and running. You can find this dropdown menu next to the play/stop buttons in the Xcode toolbar.Build and Run the Application: With the target selected, click the Run (play) button in Xcode. Choose your desired simulator or a connected iOS device. As the app runs, closely observe the Debug Area. This output will help you verify the core functionalities of the SDK.
Running Unit Tests¶
The DeliteAIExample
project includes a dedicated test target, DeliteAIExample_Tests
, with several unit tests to ensure the robustness and correctness of the DeliteAI iOS SDK’s functionalities. Developers can run these tests to verify specific components and behaviors.
The following test files are available:
RunMethodInstrumentation.swift
ProtoTest.swift
Keychaintest.swift
To run these test cases:
Open the Xcode Workspace: If not already open, open
DeliteAIExample.xcworkspace
in Xcode as described in the installation steps.Navigate to Test Files: In Xcode’s Project Navigator (left sidebar), locate the
Test
directory. Expand it to find the source files, includingRunMethodInstrumentation.swift
,ProtoTest.swift
, andKeychaintest.swift
.Execute Specific Tests: You have a few options to run the tests:
Run a Single Test Class: Open any of the test files (e.g.,
RunMethodInstrumentation.swift
). You will see a small diamond-shaped “play” button next to theclass
declaration line. Clicking this button will run all test methods within that specific class.Run a Single Test Function: Within a test file, each individual
func
(test method) also has a diamond-shaped “play” button next to its declaration. Clicking this will execute only that particular test function.
Observe Test Results: After running tests, Xcode will display the results in the Debug Area and the Test Navigator (accessible via
Cmd + 6
). Successful tests will be marked with a green checkmark, while failures will show a red ‘X’ along with details about the assertion that failed.