-
-
Save PiersonBro/e11ebe4e2e15d2bb6425 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// Tester | |
// | |
import UIKit | |
import Cartography | |
class ViewController: UIViewController { | |
lazy var crashingView: UIView = { | |
UIView(frame: CGRect()) | |
}() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
crashingView.backgroundColor = UIColor.purpleColor() | |
view.addSubview(crashingView) | |
// Crashes: | |
layout(crashingView) { (crashingView) in | |
crashingView.width == crashingView.superview!.width ~ 750 | |
return | |
} | |
// Crashes as well: | |
// let constraint = NSLayoutConstraint(item: crashingView, attribute: .Width, relatedBy: .Equal, toItem: view, attribute: .Width, multiplier: 1, constant: 0) | |
// NSLayoutConstraint.activateConstraints([constraint]) | |
// constraint.priority = 750 | |
// Doesn't Crash | |
// let constraint = NSLayoutConstraint(item: crashingView, attribute: .Width, relatedBy: .Equal, toItem: view, attribute: .Width, multiplier: 1, constant: 0) | |
// constraint.priority = 750 | |
// NSLayoutConstraint.activateConstraints([constraint]) | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment