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

一个建议:增加链式调用 #67

Open
findingfield opened this issue Jun 26, 2024 · 3 comments
Open

一个建议:增加链式调用 #67

findingfield opened this issue Jun 26, 2024 · 3 comments

Comments

@findingfield
Copy link

findingfield commented Jun 26, 2024

当前的init方法要传入一系列的ASAttributedString.Attribute,像这样:
let aa = ASAttributedString(
string: "aaaaaaaasss",
.font(.systemFont(ofSize: 12)),
.foreground(.label)
)
感觉不是很丝滑。
注意到ASAttributedString.Attribute里面的属性 let attributes: [NSAttributedString.Key: Any] 就是一个字典,但每次初始化都只加了一两个进去,能不能直接将字典放在 ASAttributedString 里面呢?然后链式调用将配置放进字典,更新覆盖,类似这样:
let aa = ASAttributedString(string: "aaaaaaaasss")
.font(.systemFont(ofSize: 12))
.foreground(.label)
.font(.systemFont(ofSize: 20))
这样感觉丝滑很多。
会考虑下吗?

@lixiang1994
Copy link
Owner

会考虑

@Liyongcong
Copy link

是的链式调用比较方便,TextAttributes可以参考下这个

@lixiang1994
Copy link
Owner

好的 近期会更新

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

3 participants