10. Switch Camera Face

To switch camera face from front to rear or vice versa, ARGSession must be paused beforehand, change camera face, and resume the ARGSession in the order.

A sample code of flipping camera face is written below.

Objective-C
Swift
Objective-C
// Sample Code. Flip Camera Face
ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];
ARGCamera *camera = [[ARGCamera alloc] init];
// ARGSession Pause
[argSession pause];
[camera toggleCamera:^{
// ARGSession Resume
[argSession run];
}];
Swift
// Sample Code. Flip Camera Face
if let session = argSession {
// ARGSession Pause
session.pause()
arCamera.toggleCamera(with: .back) {
// ARGSession Resume
session.run()
}
}