Group Group Group Group Group Group Group Group Group

Use of undeclared type 'CGFLoat'

when I try to build the game(page 97), I get the error in MyUtils.swift, Use of undeclared type ‘CGFLoat’ from this code:
extension CGFloat {
static func random() -> CGFloat {
return CGFloat(Float(arc4random()) / Float(UInt32.max))
}
static func random(min: CGFloat, max: CGFloat) -> CGFloat{
assert (min < max)
return CGFloat.random() * (max - min) + min
}

I read articles from searching on google, and you have to import UIKit. It works with no problem when I added the import UIKIt. Importing SpriteKit works too!

@game_gecko Just a heads up that you can also import Core Graphics to work with CGFloat.

This topic was automatically closed after 166 days. New replies are no longer allowed.