iOS

Swift Package

The Replay Swift package is hosted on GitHub. Once added as a package dependency to your Xcode project, you can replace the rootViewController:

import Replay
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = ReplayViewController()
self.window = window
window.makeKeyAndVisible()
}
}
}

Your image and audio assets also need to be added to your Xcode project. See Replay Starter for an example setup.

ReplayViewController(hideStatusBar, useLocalHost)

Parameters

  • hideStatusBar: (Optional) A boolean to set if the status bar is hidden or not. Default true.
  • useLocalHost: (Optional) Set to true to debug JavaScript errors, but note that assets can't be loaded in this mode. Default false.

Inputs

Since Replay Swift embeds your game as a web view, the device.inputs parameter of Sprite methods is an alias of the Web package's inputs:

type iOSInputs = WebInputs;

The @replay/swift package exports this type for TypeScript projects.