iOS Native - CocoaPods
iOS Native Installation Guide (CocoaPods)¶
This document explains how to add Hercules to an iOS project that already uses CocoaPods.
- We recommend using SPM because the discontinuation of CocoaPods maintenance may cause compatibility issues with future versions of Xcode.
Hercules Spec repository:
https://github.com/Com2uSPlatformCorp/Hercules-iOS
1. Add the Hercules Spec Repository to the Podfile¶
Add the Hercules repository to the source configuration in your existing Podfile.
Example:
Warning
Be careful not to remove any existing sources.
2. Add Hercules¶
Choose a version and add a Hercules entry inside the target. This guide explicitly uses version 26.8.31.
Example:
$HERCULES_VERSION = '26.8.31'
target 'GameApp' do
# Existing Pods
pod 'Library 1'
pod 'Library 2'
# Add Hercules here
pod 'Hercules', $HERCULES_VERSION
end
Warning
Be careful not to remove the existing content above and below.
3. Install Pods¶
Run the following command in the directory containing your project's Podfile.
4. Change the Version¶
To change the Hercules version, modify only the $HERCULES_VERSION variable in the Podfile.
Example:
Run the following command in the directory containing your project's Podfile.
5. Check the Installed Version¶
You can check the Hercules version currently installed in your project in Podfile.lock.
Example:
6. Use the API¶
Objective-C / Objective-C++¶
Open the project using .xsworkspace and include the Hercules.h header to use the API.
Example:
#import <Hercules/Hercules.h>
...
unsigned int version = HerculesGetVersion();
NSLog(@"Hercules version: %u", version);
Initialization is performed automatically when the Hive SDK is initialized.
You do not need to call InitializeHercules separately.