简体   繁体   中英

Xcode 6 Beta 5 Swift Playground: Cannot find symbol for CGRectMake()

Since updating to Xcode 6 beta 5 my playground code will no longer compile/run and logs:

Playground execution failed: error: Couldn't lookup symbols: _CGRectMake

It should be simple enough and worked fine on the previous versions. The only code I am running up to that point is as follows:

import Foundation
import UIKit
import XCPlayground
import QuartzCore
let frameRect: CGRect = CGRectMake(0, 0, 500, 500)
var customView = UIView(frame: frameRect)

Just wondering if anyone else is having problems with Playground and found solutions. My hunch is that is just a beta bug.

You should use let rect = CGRect(x: 0, y: 0, width: 500, height: 500) instead.

CGRectMake still works for me though... Did you create a new playground with beta 5? I've found it's best to always create a new playground for each new beta.

Try just removing the "make":

import Foundation
import UIKit
import XCPlayground
import QuartzCore
let frameRect: CGRect = CGRect(0, 0, 500, 500)
var customView = UIView(frame: frameRect)

Also, you may get another weird error with your view when you import XCPlayground, so try this:

customView.setTranslatesAutoresizingMaskIntoConstraints(true)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM