Skip to main content

iOS - Module Structure

In iOS, modules also referred to as swift packages which allow you to extend and customize the functionality of the Q2 Mobile Application with custom native code. Whether you're building UI components, handling lifecycle events, defining API methods, or integrating push notifications, modules provide a structured and scalable way to add and manage native features.

Step 1: Invoke q2-mobile-cli tool on terminal.

Step 2: Choose Create Mobile Module from the menu.

Step 3: Provide name to your module.

Example: if you enter demo as name of your module structure would look like as follow. We will prefix with q2 and suffix with ios. if you have any question around naming please submit ticket via q2developer.com

q2-demo-ios
├── Package.swift
├── q2-demo-ios
│ ├── Frameworks
│ │ └── SomeFramework.xcframework
│ └── sources
│ └── Q2Demo
│ ├── Resources
│ │ ├── Images
│ │ └── Localization
│ ├── Public
│ │ └── Q2DemoModule.swift
│ └── Private
│ └── SomePrivateFile.swift
├── Q2DevApp
│ └── Q2DevApp.xcworkspace
├── Q2MobileApp.xcconfig
└── settings.json

Step 4: Provide module identifier or accept defaults to com.q2.mobile.module.name.

if you have provided module name as demo, com.q2.mobile.module.demo would become identifier or route which you will use later on to identify or invoke your module via Tecton within FI's mobile app containing your module.

Module q2-demo-ios would be created successfully at this stage.

Step 5: Exit the cli tool.

Step 6: Open module using DevApp in Xcode. Go inside the module folder. supply following command or open workspace manually.

open Q2DevApp/Q2DevApp.xcworkspace

Structure of the project should look like as follow:

note

if Xcode is correctly connected to code.q2developer.com self hosted server then it will be able to resolve all required dependencies and you should be able to see following structure.

.
├── Q2DevApp
│ └── settings
├── Q2DevAppDependencies
│ └── Package
└── Package Dependencies
├── q2-demo-ios (local)
└── q2-mobile-ios (x.y.z)
note

You should avoid making any changes within Q2DevApp and Q2DevAppDependencies.

Step 7: Launch Q2DevApp target on one of the simulator and validate dev app works correctly. if not feel free to submit ticket.

Updating Base Q2 Mobile SDK Version

To update the minimum mobile SDK version (for example, to 25.6.0), you need to update the module's Package.swift file.

Update the package dependency URL with the new version:

.package(url: "https://code.q2developer.com/Q2Antilles/native/q2-mobile-ios.git",  "25.6.0"..."100.0.0")

After making this change, perform the following commands in Xcode:

  1. Product Menu > Clean Build Folder
  2. File Menu > Packages > Reset Package Caches

Once Xcode fetches the new mobile SDK dependency, you should be able to see q2-mobile-ios 25.6.0 under packages in the Xcode project navigator.

note

Q2MobileApp.xcconfig / MARKETING_VERSION update to 25.6.0 is optional. You can change it to 25.6.0 but it won't resolve to the new version.