I am new to swiftUI to make view as like what I done in UIkit. tried almost few hours did not get success.
here is my code in UIkit which is working good in my project.
var positionY = self.view.frame.height
let timer = Timer.scheduledTimer(withTimeInterval: 3.0, repeats: true) { (timer) in
// do stuff 3 seconds later
positionY = positionY - 50
let bubble = UIView(frame: CGRect(x: self.view.frame.width/2, y: positionY, width: 50, height: 50))
bubble.backgroundColor = UIColor.red
self.view.addSubview(bubble)
}
RunLoop.current.add(timer, forMode: .common)
now I am working on SwifUI. I need same behaviour on my swiftUI project because of I have done lot of stuff on this code.