Esqarrouth/EZSwiftExtensions

Lose "public"

taogeyijiu opened this issue · 7 comments

UIAlertControllerExtensions:
extension UIAlertController {
/// EZSE: Easy way to present UIAlertController
func show() {
UIApplication.shared.keyWindow?.rootViewController?.present(self, animated: true, completion: nil)
}
}
And StringExtensions:
///EZSE: Returns hight of rendered string
func height(_ width: CGFloat, font: UIFont, lineBreakMode: NSLineBreakMode?) -> CGFloat {
var attrib: [String: AnyObject] = [NSFontAttributeName: font]
if lineBreakMode != nil {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineBreakMode = lineBreakMode!
attrib.updateValue(paragraphStyle, forKey: NSParagraphStyleAttributeName)
}
let size = CGSize(width: width, height: CGFloat(DBL_MAX))
return ceil((self as NSString).boundingRect(with: size, options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes:attrib, context: nil).height)
}

This two method is do not work, why?

Not sure I understand the premise of this question. Is it that these methods are not accessible to callers ? Or is there a runtime failure of some sorts?

methods are not accessible to callers ,I use cocoapods

gotcha. I will fix that oversight.

So string height has been recently fixed in 2395fa54

I will put out a PR for the other one.