Fixed runtime errors. Now to fix bugs!

This commit is contained in:
Pietro Gagliardi 2015-08-07 15:07:53 -04:00
parent dbde124471
commit 9aeeeab812
4 changed files with 6 additions and 4 deletions

View File

@ -7,7 +7,7 @@ import Cocoa
class tBoxContainer : NSView {
override var alignmentRectInsets: NSEdgeInsets {
get {
debugPrint("in tBoxContainer.alignmentRectInsets")
print("in tBoxContainer.alignmentRectInsets")
return NSEdgeInsetsMake(50, 50, 50, 50)
}
}

View File

@ -85,7 +85,9 @@ func main() {
var app = NSApplication.sharedApplication()
app.setActivationPolicy(NSApplicationActivationPolicy.Regular)
app.delegate = appDelegate()
// NSApplication.delegate is weak; if we don't use the temporary variable, the delegate will die before it's used
var delegate = appDelegate()
app.delegate = delegate
app.run()
}

View File

@ -5,7 +5,7 @@ import Cocoa
class tSpinboxContainer : NSView {
override var alignmentRectInsets: NSEdgeInsets {
get {
debugPrint("in tSpinboxContainer.alignmentRectInsets")
print("in tSpinboxContainer.alignmentRectInsets")
return NSEdgeInsetsMake(50, 50, 50, 50)
}
}

View File

@ -4,7 +4,7 @@ import Cocoa
// auto layout helpers
func tIsAmbiguous(view: NSView, indent: Int) {
var s = String(count: indent, repeatedValue: " " as Character)
debugPrint("\(s) \(view.className) \(view.hasAmbiguousLayout)")
print("\(s) \(view.className) \(view.hasAmbiguousLayout)")
if view.hasAmbiguousLayout {
view.window?.visualizeConstraints(view.superview!.constraints)
}