We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
AttributedText cannot wrap automatically
AttributedText(getAttributedString(text: text)) .font(.pfRegular(size: 12)) .foregroundColor(.globeBlack) .environment(.lineLimit, 2) .environment(.lineBreakMode, .byWordWrapping) .environment(.lineSpacing, 3) .frame(width: appWidth - 80, alignment: .leading)
func getAttributedString(text: String) -> NSAttributedString { let att = NSMutableAttributedString(string: text + " ") att.setAttributes([.font: UIFont.pfRegular(size: 12)], range: NSRange(location: 0, length: text.count)) att.setAttributes([.foregroundColor: UIColor.globeBlack], range: NSRange(location: 0, length: text.count)) let tach = NSTextAttachment(image: UIImage.xin ?? UIImage()) tach.bounds = CGRectMake(0, -2, 36, 15) let imageAtt = NSAttributedString(attachment: tach) att.insert(imageAtt, at: att.length) return att }
The text was updated successfully, but these errors were encountered:
vmanot
No branches or pull requests
AttributedText cannot wrap automatically
AttributedText(getAttributedString(text: text))
.font(.pfRegular(size: 12))
.foregroundColor(.globeBlack)
.environment(.lineLimit, 2)
.environment(.lineBreakMode, .byWordWrapping)
.environment(.lineSpacing, 3)
.frame(width: appWidth - 80, alignment: .leading)
func getAttributedString(text: String) -> NSAttributedString {
let att = NSMutableAttributedString(string: text + " ")
att.setAttributes([.font: UIFont.pfRegular(size: 12)], range: NSRange(location: 0, length: text.count))
att.setAttributes([.foregroundColor: UIColor.globeBlack], range: NSRange(location: 0, length: text.count))
let tach = NSTextAttachment(image: UIImage.xin ?? UIImage())
tach.bounds = CGRectMake(0, -2, 36, 15)
let imageAtt = NSAttributedString(attachment: tach)
att.insert(imageAtt, at: att.length)
return att
}
The text was updated successfully, but these errors were encountered: