Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSAttributedStringKey' .font to .zone? #10

Open
masuhara opened this issue Sep 27, 2018 · 1 comment
Open

NSAttributedStringKey' .font to .zone? #10

masuhara opened this issue Sep 27, 2018 · 1 comment

Comments

@masuhara
Copy link

extension String {
    fileprivate func height(withConstrainedWidth width: CGFloat, font: UIFont) -> CGFloat {
        let constraintRect = CGSize(width: width, height: .greatestFiniteMagnitude)
        
**// Error: Type 'NSAttributedStringKey' (aka 'NSString') has no member 'font'; did you mean 'zone'?**
        let boundingBox = self.boundingRect(with: constraintRect, options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font: font], context: nil)
        
        return boundingBox.height
    }
    
    fileprivate func width(withConstrainedHeight height: CGFloat, font: UIFont) -> CGFloat {
        let constraintRect = CGSize(width: .greatestFiniteMagnitude, height: height)

**// Error: Type 'NSAttributedStringKey' (aka 'NSString') has no member 'font'; did you mean 'zone'?**
        let boundingBox = self.boundingRect(with: constraintRect, options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font: font], context: nil)
        
        return boundingBox.width
    }
}
@smkdoss73
Copy link

am also facing same issues

Type 'NSAttributedStringKey' (aka 'NSString') has no member 'font'; did you mean 'zone'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants