Sprite-Kit – How to use WhiteColor in SWIFT and Spritekit

I am running Yosemite and Xcode 6. I created a new project using the “Game” option SpriteKit and Swift.

Check in GameScene.swift In the overlay of didMoveToView(), I added the following line to try to change the background color:

self.backgroundColor = SKColor(whiteColor)

This will compile But it won’t run, because the error “Stopped with unresolved identifier’whiteColor'”

The only import is:

import SpriteKit 

Do I need another import to define whiteColor (I assume it is a constant in a certain header file?

[SKColor whiteColor] is a class method, as usual, it is converted to SKColor.whiteColor()

self.backgroundColor = SKColor. whiteColor()

I am running Yosemite and Xcode 6. I created a new project using the "Game" option SpriteKit and Swift.

In the overlay of didMoveToView() in GameScene.swift, I added the following line to try to change the background color:

self.backgroundColor = SKColor(whiteColor)

This will compile but will not run. It stops with the error "Using unresolved identifier'whiteColor'"

The only import is:

import SpriteKit

Do I need another import to define whiteColor (I assume it is a constant in a header file?

[SKColor whiteColor] is a class method, as usual, it is converted to SKColor.whiteColor()

self.backgroundColor = SKColor.whiteColor()

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 444 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.