Categories
developer documentation v0.0.27
mimik Developer Documentation
  • Tutorials
  • Integrating the mimik Client Library into an iOS project

Integrating the mimik Client Library into an iOS project

Objective

The objective of this document is to demonstrate the various concepts iOS software developers need to understand to integrate the mimik Client Library with an iOS application.

Intended Readers

The intended readers of this document are iOS software developers and system integrators using the mimik Client Library when developing an iOS application.

NOTE:

The full mimik Client Library API reference documentation is available online, as well as in the XCode built-in documentation system.

What You'll Be Doing

In this article you'll be covering the following topics that are relevant to integrating the mimik Client Library into an iOS application:

  • Configuring a Podfile
  • Installing mimik Client Library cocoapods
  • Importing mimik Client Library modules
  • Initializing mimik Client Library

Prerequisites

  • Connecting a real iOS device to the development computer and selecting it as the target in Xcode. This tutorial will not work with an iOS Simulator.
NOTE:

Working with the iOS Simulator and the mimik Client Libraries entails some special consideration. For more more information about iOS Simulator support see this tutorial.

Configuring a Podfile

The mimik Client Library cocoapods get installed in an iOS project using the CocoaPods dependency manager. Listing 1 below shows an example of a CocoaPods's Podfile that developers need to use with their iOS projects. The Podfile defines the source code repository locations containing the relevant dependencies, as shown in Lines 2-3. It also declares the mimik Client Library pod components at Lines 7-8. With additional configuration requirements at Lines 11-18


1: platform :ios, '15.0'
2: source 'https://github.com/CocoaPods/Specs.git'
3: source 'https://github.com/mimikgit/cocoapod-edge-specs.git'
4:
5: target 'example' do
6: use_frameworks!
7: pod 'EdgeCore'
8: pod 'mimOE-SE-iOS-developer'
9: end
10:
11: post_install do |installer|
12: installer.pods_project.targets.each do |target|
13: target.build_configurations.each do |config|
14: config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
15: config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
16: end
17: end
18: end

Listing 1: An example Podfile for working with mimik Client Library


Installing mimik Client Library cocoapods

Once the dependencies are defined in a Podfile, developers initiate the installation of EdgeCore and mimOE-SE-iOS-developer cocoapods as well as their dependencies into the iOS project using the following command:

pod install --repo-update

Running pod install against the Podfile as described above displays output similar to the following:

Analyzing dependencies
Downloading dependencies
Installing Alamofire
Installing AppAuth
Installing EdgeCore
Installing mimOE-SE-iOS-developer
Installing JWTDecode
Installing SwiftyJSON
Generating Pods project
Integrating client project

At this point, the mimik Client Library is installed in the iOS project's workspace, and is ready to have its modules imported in the code.

Importing mimik Client Library modules

Before developers can initialize the mimik Client Library components, they need to import the EdgeCore and EdgeEngine modules references into their code. The code example below shows you how to use the import command inline to do so.


import EdgeCore
import EdgeEngine

Initializing mimik Client Library

Before developers can start taking advantage of the mimik Components interface, they need to initialize the mimik client library in a form of a EdgeClient class instance. These two import statements import both the EdgeCore and EdgeEngine modules into the project. Listing 2 below shows an example of how to do this.


1: import EdgeCore
2: import EdgeEngine
3:
4: let edgeClient: EdgeClient = {
5: EdgeClient.setLoggingLevel(level: .debug, module: .edgeCore)
6: EdgeClient.setLoggingLevel(level: .debug, module: .edgeEngine)
7: return EdgeClient()
8: }()

Listing 2: The code for initializing the mimik Client Library in an iOS application


Notice the lien return EdgeClient(). This is where the instance of EdgeClient class gets created.

setLoggingLevel lines control the console logging output levels from the mimik CLient Library Components.

Ready

With that, the mimik Client Library has been initialized, its modules imported and its interface is ready to be used in the iOS project space.

NOTE:

The full mimik Client Library API reference documentation is available online, as well as in the XCode built-in documentation system.

Was this article helpful?

© mimik technology, Inc. all rights reserved