I have a simple UIViewRepresentable
of a MarqueeLabel, but it does not work. My guess is that the frame is not correctly set, but I don't know what to pass to the MarqueeLabel initialiser as a frame. Using geometry Reader or some other way to get the Marquee effect is not an option.
struct UILabelView : UIViewRepresentable {
var text: String
typealias UIViewType = MarqueeLabel
func makeUIView(context: UIViewRepresentableContext<UILabelView>) -> MarqueeLabel {
let label = MarqueeLabel()
print(label.frame.size)
label.text = text
return label
}
func updateUIView(_ uiView: MarqueeLabel, context: UIViewRepresentableContext<UILabelView>) { }
}
I have tried using this to no avail. Also, I have looked at this Question but there is no answer.
The View is used like this:
UILabelView(text: "a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20")
setting .frame(width: 40)
on this view does not help.