【发布时间】:2015-11-22 02:11:17
【问题描述】:
在这个例子中,哪个是合适的约定?
static func getWindowSize(scene: SKScene) -> NSRect? {
if let windowSize = scene.view?.bounds {
return windowSize
} else {
print("Could not get window size")
}
return NSRect()
}
或
static func getWindowSize(scene: SKScene) -> NSRect? {
guard let windowSize = scene.view?.bounds else {
print("Could not get window size")
return NSRect()
}
return windowSize
}
【问题讨论】: