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
class LabelWithPadding: UILabel { | |
@objc var padding = UIEdgeInsets.zero { | |
didSet { invalidateIntrinsicContentSize() } | |
} | |
@IBInspectable public var bottomInset: CGFloat { | |
get { return padding.bottom } | |
set { padding.bottom = newValue } | |
} |
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
static func compressImage(image:UIImage) -> Data? { | |
// Reducing file size to a 10th | |
var actualHeight: CGFloat = image.size.height | |
var actualWidth: CGFloat = image.size.width | |
let maxHeight: CGFloat = 1136.0 | |
let maxWidth: CGFloat = 640.0 | |
var imgRatio: CGFloat = actualWidth/actualHeight | |
let maxRatio: CGFloat = maxWidth/maxHeight | |
var compressionQuality: CGFloat = 0.7 | |