最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ios - How to Apply Custom Attributes to a SwiftUI Text? - Stack Overflow

programmeradmin2浏览0评论

I'm trying to create a SwiftUI extension on Text that allows me to apply custom attributes, similar to how we use NSAttributedString in UIKit. Ideally, I want to write something like this:

public extension Text {
func applyAttributes(_ myCustomAttributes: [NSAttributedString.Key: Any]) -> some View {
    let text = NSAttributedString(
        string: self.textValue, // 
发布评论

评论列表(0)

  1. 暂无评论