Created
February 1, 2018 07:45
-
-
Save Anatoli-Petrosyants/2f9409998938d164b0f5bbae3dc3d639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSTextAttachment { | |
func setImageHeight(height: CGFloat) { | |
guard let image = image else { return } | |
let ratio = image.size.width / image.size.height | |
bounds = CGRect(x: bounds.origin.x, y: bounds.origin.y, width: ratio * height, height: height) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment