How to save an AR Scene as an image.

Oscar de la Hera
AR Tips And Tricks
Published in
1 min readJul 10, 2018

Paste this code and associate @IBAction func saveSceneViewToImage() to an event.

@IBAction func saveSceneViewToImage(){// Save as UI ImageUIImageWriteToSavedPhotosAlbum(sceneView.snapshot(), self, #selector(image(_:didFinishSavingWithError:contextInfo:)), nil)}@objc func image(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) {if let error = error {// we got back an error!let ac = UIAlertController(title: "Save error", message: error.localizedDescription, preferredStyle: .alert)ac.addAction(UIAlertAction(title: "OK", style: .default))present(ac, animated: true)} else {let ac = UIAlertController(title: "Saved!", message: "Your altered image has been saved to your photos.", preferredStyle: .alert)ac.addAction(UIAlertAction(title: "OK", style: .default))present(ac, animated: true)}}

Oscar

--

--

Oscar de la Hera
AR Tips And Tricks

Oscar is an award-winning Spanish Inventor whose work impacts lives through brands that include Nike, MoMA and Samsung.