Skip to content

Instantly share code, notes, and snippets.

@imgly-gists
Last active October 26, 2017 08:11
Show Gist options
  • Select an option

  • Save imgly-gists/e7e2fc0f6be89617f3d3468e7d4216ca to your computer and use it in GitHub Desktop.

Select an option

Save imgly-gists/e7e2fc0f6be89617f3d3468e7d4216ca to your computer and use it in GitHub Desktop.
func stickerSelectionController(_ stickerSelectionController: StickerSelectionController, didSelect sticker: Sticker, with image: UIImage) {
guard let referenceSize = delegate?.stickerViewControllerReferenceSize(self) else { return }
var model = StickerSpriteModel(sticker: sticker)
let aspectRatio = referenceSize.width / referenceSize.height
model.normalizedCenter = CGPoint(x: 0.5, y: 0.5)
model.normalizedSize = CGSize(width: 0.3, height: 0.3 * aspectRatio)
delegate?.stickerViewControllerDidFinish(self, stickerModel: model)
dismiss(animated: true, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment