I am working on an application where the user clicks to add a station, from there a pop-up window will appear asking the user for the appropriate information, the UIView will be animated but I am having trouble getting it to work from insides its separate file.
Here is the code from the Animations.swift file.
import Foundation
import UIKit
class Animations: UIView {
func animatePopUpIn(view: UIView, controller: UIViewController) {
controller.view.addSubview(view)
view.center = center
view.transform = CGAffineTransform.init(scaleX: 1.3, y: 1.3)
view.alpha = 0
UIView.animate(withDuration: 0.4) {
controller.view.alpha = 1
controller.view.transform = CGAffineTransform.identity
}
}
}
Here is the code for the StationController.swift file.
import UIKit
class StationController: UIViewController {
@IBOutlet var addStationView: UIView!
var animation = Animations()
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "Stations"
}
@IBAction func addStationTapped(_ sender: Any) {
animation.animatePopUpIn(view: addStationView, controller: self)
print("Displayed Pop Up")
}
@IBAction func dismissPopUpTapped(_ sender: Any) {
}
}
For some reason upon tapping addStationTapped nothing appears, any help would be great for I am fairly new to working with classes in this manner. Thanks in advance.