Search code examples
iosswiftxcode6swift-playgroundcgrectmake

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.


Solution

  • 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)