Structures
The following structures are available globally.
-
UserDefaults Wrapper
使用
See more// HandyJSON Type class Person: HandyJSON { var name = "" required init() {} } @UserDefaultsWrapper(key: .handyJSON("person")) var person = Person() // Base Type @UserDefaultsWrapper(key: .base("username")) var username = "username"
Declaration
Swift
@propertyWrapper public struct UserDefaultsWrapper<T> where T : HandyJSON
-
富文本字符串插值
使用
See morelet attributedString: AttributedString = """ \("你好,世界", .color(.red), .font(UIFont.systemFont(ofSize: 20)), .bgColor(.green))\n \("百度URL", .link("https://www.baidu.com"), .color(.red), .font(UIFont.systemFont(ofSize: 20)))\n """ // 修改URL颜色 // 要打开URL, 需要实现UITextView代理方法shouldInteractWith textView.linkTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.brown] textView.attributedText = attributedString.attributedString
Declaration
Swift
public struct AttributedString
extension AttributedString: ExpressibleByStringLiteral
extension AttributedString: CustomStringConvertible
extension AttributedString: ExpressibleByStringInterpolation
-
Declaration
Swift
public struct FontAttribute
-
Declaration
Swift
public struct ActionItem