A SwfitUI style UIKit
-
Xcode 11
-
Swift5.0
let label = UILabel()
label.swift.text = Text("text1")
.background(.black)
label.swift.text += Text("text2")
.foregroundColor(Color(.red))
label.swift.text?.onTapGesture { print("tap") }
label.swift.text += Text("text3\(Text: #imageLiteral(resourceName: "icon_sale_member"), width: 17)")
.foregroundColor(.yellow)
.tracking(10)
label.swift.text += Text("text4")
.onLongPressGesture { print("longPress") }
Also support UITextField and UITextView, but tap/longPress gesture may conflict with own gesture
The usage is the same as SwiftUI
Font().italic()
get UIFont
Font().italic().uiFont