Comments (6)
其实你可以扩展实现 比如:
public extension Array where Element == ASAttributedString.Attribute {
static var defalut: [ASAttributedString.Attribute] = [
.font(.systemFont(ofSize: 13)),
.foreground(.black)
]
static let xxxx: [ASAttributedString.Attribute] = []
}
from attributedstring.
按照上面的扩展实现报错了。
from attributedstring.
\("test", with: .defalut)
from attributedstring.
但是这样的话,后面就无法在增加其他 attribute 属性了。
还是希望能实现这样的调用效果:
"""
("fontStyle: .sbuheadline", .fontStyle(.subheadline), .background(.systemBackground), .foreground(.label))
"""
from attributedstring.
\("test", with: .defalut + [.kern(1), .xxxxx])
from attributedstring.
嗯嗯,好的。
谢谢!
from attributedstring.
Related Issues (20)
- ASAttributedString如何通过range截取部分富文本? HOT 10
- ViewAttachment 能否将view开放出来 HOT 4
- 添加Action的情况下 文字颜色始终是蓝色,怎么修改呢 HOT 2
- AttributedString.swift文件中别名的问题 HOT 1
- TextView 图片偏移显示不全 HOT 2
- XCode14打包在iOS12设备上崩溃问题 HOT 5
- 挺喜欢这个库,但是使用的时候遇到了一些问题 HOT 15
- UIButton下action点击无效 HOT 1
- 点击事件崩溃 HOT 3
- iOS16 UITextView 默认使用的TextKit2 如遇到问题 可以切换到 TextKit 1
- 如何在SwiftUI中使用? HOT 1
- 根据多个Range设置字体颜色时,只有最后一个生效 HOT 3
- Build error with Objective-C project HOT 1
- How to create from HTML? HOT 1
- UITextView 如果设置了 isSelectable = false HOT 1
- Crash at Action.swift HOT 1
- UITextView 如果设置了 isSelectable = true 就不能触发点击事件 HOT 1
- 高亮时的样式可以默认用非高亮的样式吗? HOT 4
- 是否可替换富文本内容?
- 一个建议:增加链式调用 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from attributedstring.