I'm trying to create something using swift playgrounds and am having some difficulty with the auto layout. Here is my code
import PlaygroundSupport
import UIKit
class ViewController: UIViewController {
var gameVC = GameView()
override func viewDidLoad() {
super.viewDidLoad()
gameVC.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(gameVC)
gameVC.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
gameVC.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
gameVC.widthAnchor.constraint(equalToConstraint: view.frame.width).isActive = true
gameVC.heightAnchor.constraint(equalToConstraint: view.frame.height).isActive = true
}
}
I get errors on the line
gameVC.widthAnchor.constraint(equalToConstraint: view.frame.width).isActive = true
saying
Expression type '@lvalue CGRect' is ambiguous without more context
Thanks in advance!