Hi I am making a game and I have added a share button to the game. I want the user to be able to share a message, URL, and screenshot along side each other in one message.Th
update: Xcode 8.2.1 • Swift 3.0.2
You need to add the import statement and this extension to your game scene:
import UIKit
extension UIView {
var snapshot: UIImage? {
UIGraphicsBeginImageContextWithOptions(bounds.size, false, 0)
defer { UIGraphicsEndImageContext() }
drawHierarchy(in: bounds, afterScreenUpdates: true)
return UIGraphicsGetImageFromCurrentImageContext()
}
}
let myImage = view?.snapshot