iOS Wrapper Documentation
The Backtestx Charts iOS wrapper enables developers to integrate interactive trading charts into Swift-based iOS applications. It embeds a file-access-safe WKWebView and maps charting functionality directly to native Swift properties.
Overview
Instead of managing web assets, local files, and evaluating raw JavaScript strings manually, you can import our official iOS Swift Package. The library abstracts the web code away and provides a clean, native experience.
Installation
The wrapper library is open-source and hosted on GitHub. You can install it using Xcode's Package Manager or CocoaPods.
Swift Package Manager (SPM)
In Xcode, go to File > Add Package Dependencies... and paste the repository URL:
CocoaPods
Specify the dependency in your Podfile pointing to the GitHub source:
Usage
1. Add to Layout
Import the module in your Swift file, instantiate the view, and add it to your view controller's hierarchy:
import BacktestxCharts
class ChartViewController: UIViewController {
var chartView: BacktestxChartView!
override func viewDidLoad() {
super.viewDidLoad() chartView = BacktestxChartView(frame: self.view.bounds)
chartView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.view.addSubview(chartView)
}
}
2. Set Data
Update the chart data dynamically by passing a JSON string containing an array of bars/candles:
[
{"time": "2026-06-10", "open": 100.0, "high": 105.0, "low": 98.0, "close": 102.5},
{"time": "2026-06-11", "open": 102.5, "high": 108.0, "low": 101.0, "close": 107.2}
]
\"\"\"
chartView.updateData(jsonData: candleData)
3. Switch Asset Symbol
Custom Features Support
All proprietary features included in your Backtestx Charts engine (such as the left drawing toolbar, floating toolbar actions, and technical indicators) are supported natively when running inside your iOS wrapper.