find another answer:
extension UILabel {
func animation(typing value: String, duration: Double){
for char in value {
self.text?.append(char)
RunLoop.current.run(until: Date() + duration)
}
}
}
and called in viewDidAppear, not in viewDidLoad
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
Label.text = ""
Label.animation(typing: "Здесь много всякого разного текста.", duration: 0.1)
}
i don't know is it right or not, but it works )
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…