Swift bindings generator for Epic Online Services framework.
This tool takes the C language EOSSDK.framework as input and generates object oriented Swift bindings for the C SDK.
The Swift API uses only Swift types. All pointers required by the C SDK are managed internally.
- The autogenerated bindings can be found here: https://github.com/roman-dzieciol/swift-eos
- Sample app: https://github.com/roman-dzieciol/swift-eos-sample
- Swift-compatible EOS SDK xcframework binary: https://github.com/roman-dzieciol/swift-eos-build/releases/tag/0.0.1
- Testable (for unit tests only) version of the EOS SDK: https://github.com/roman-dzieciol/swift-eos-test
- C++ UE4-based implementation (WIP) https://github.com/roman-dzieciol/ue-eos-build
- Patched binaries (after launching the tool):
./Temp/EOS-SDK-IOS-16697186-v1/EOSSDK.xcframework
The outputted macos-x86_64
framework is currently just for non-prod unit test purposes, as the iOS one is currently available for ios-arm64
, which doesn't allow launching unit tests.
First, Download the iOS and C version of EOS SDK from https://dev.epicgames.com/portal/
Place the contents of the archives parallel to this source code repository, ie:
/Users/username/repositories/EOS-SDK-IOS-16697186-v1/SDK/Bin/IOS/EOSSDK.framework
/Users/username/repositories/EOS-SDK-16697186-v1/SDK/Bin/libEOSSDK-Mac-Shipping
/Users/username/repositories/swift-eos-build/
Then, edit eos-version.txt
and eos-version.macos.txt
if needed so that it contains the versions/names of the folders above, ie EOS-SDK-IOS-16697186-v1
and EOS-SDK-16697186-v1
There are two ways you can launch it:
This will allow you to debug and see all the log messages. You will need to perform some setup manually.
- Launch
./Scripts/build-clang-module
to create a patched version of the SDK - Launch
./Scripts/dump-eossdk-ast.sh
to get the AST of SDK headers - Open
Package.swift
in Xcode, change the scheme toswift-eos-build
, and device toMacOS
- Run the scheme to compile and launch the tool
The script steps are needed only once for each version of SDK.
This will perform the two steps above, then compile and launch the tool.
- Launch
swift-eos-build.command
from commandline or Finder
To see the debug logs from commandline output, open Console.app
before launching then search or filter for subsystem dev.roman.eos
I recommend launching from Xcode as this is still under development.
The bindings will be in ./Temp/EOS-SDK-IOS-16697186-v1/Bindings
subdirectory of the repo.
You can use them as Swift package, or copy them all (or some) to your project.
Binding depend on the emitter ./Temp/EOS-SDK-IOS-16697186-v1/EOSSDK.xcframework
bundle. For local development you can symlink it into your package directory.
By default nothing will be overwritten, so if you try to launch it again you'll get an error.
To move automatically the generated output to trash, add --allow-delete
to Xcode scheme's arguments, or to the swift-eos-build.sh
commandline.
Patches the C EOSSDK.framework so that it can be imported into Swift projects
Outputs clang AST of the EOS SDK, including comment nodes, for use by SwiftEOSBuild
Outputs Swift API for EOS SDK, including all neccesary memory management code
By default, scripts expect the official EOS SDK to be placed in ../SDK/<EOS Version>/EOSSDK.framework
folder, relative to the repository.
- Object oriented Swift bindings API for the EOSSDK.framework
- All pointers required by C framework are managed internally
- Depends on EOSSDK.framework
- A patched version of the official SDK, includes a Swift modulemap and tweaks to headers so that the framework can be imported into Swift projects
- The modified framework packaged as xcframework for Swift Package Manager compatibility
- Emitted C EOS SDK AST in Clang JSON format, including comment nodes, for internal use by the tooling
- Emitted C Headers & implementation for special testable version of EOS SDK
- Public API & ABI is identical to official release, so can be used in place of standard SDK.
- EOSSDK implementation is replaced with calls to public function pointers, which tests can customize.
- Provide function pointer implementations to test values that EOSSDK api receives and return custom results.
- Use for end-to-end unit/performance/allocation tests only
- See also: https://github.com/roman-dzieciol/swift-eos-test