I am making an attempt to make a round UIView greater. How can I try this utilizing swift? This is my code.
import Basis
import UIKit
class FirstViewController: UIViewController {
non-public let circleView: UIView = {
let view = UIView()
view.backgroundColor = UIColor(pink: 0.63, inexperienced: 0.14, blue: 0.92, alpha: 1.00)
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
non-public let imageView: UIImageView = {
let imageView = UIImageView()
imageView.picture = UIImage(named: "logo-purple") // Instance picture
imageView.contentMode = .scaleAspectFit
imageView.translatesAutoresizingMaskIntoConstraints = false
return imageView
}()
override func viewDidLoad() {
tremendous.viewDidLoad()
view.backgroundColor = .white
setupViews()
animateCircleView()
}
non-public func setupViews() {
view.addSubview(circleView)
view.addSubview(imageView)
// Constraints for the circleView (begin small within the heart)
NSLayoutConstraint.activate([
circleView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
circleView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
circleView.widthAnchor.constraint(equalToConstant: 100),
circleView.heightAnchor.constraint(equalToConstant: 100)
])
// Constraints for the imageView (centered within the display screen)
NSLayoutConstraint.activate([
imageView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
imageView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
imageView.widthAnchor.constraint(equalToConstant: 128),
imageView.heightAnchor.constraint(equalToConstant: 128)
])
circleView.clipsToBounds = true
}
non-public func animateCircleView() {
// Set off the animation after the view has appeared
DispatchQueue.fundamental.asyncAfter(deadline: .now() + 0.5) {
UIView.animate(withDuration: 2.0, delay: 0, choices: .curveEaseOut, animations: {
// Replace the circleView to develop bigger than the display screen
self.circleView.layer.cornerRadius = self.circleView.body.measurement.width/2
self.circleView.rework = CGAffineTransform(scaleX: 10, y: 10)
}, completion: { _ in
self.performSegue(withIdentifier: "toWelcome", sender: self)
})
}
}
}