Skip to content

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

Open
@findingfield

Description

@findingfield

当前的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))
这样感觉丝滑很多。
会考虑下吗?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions