Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Eduardo Rojas
Eduardo Rojas
4,084 Points

WTF is happening? Swift

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

thats the error i get while compiling please help!

the only code i have is this:

class GameScene: SKScene {
    override func didMoveToView(view: SKView) {
        /* Setup your scene here */
        var button = SKSpriteNode(color: .redColor(), size: CGSizeMake(CGRectGetMaxX(self.frame), 40))

        self.addChild(button)
    }

    override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
        /* Called when a touch begins */

        for touch: AnyObject in touches {

        }
    }

    override func update(currentTime: CFTimeInterval) {
        /* Called before each frame is rendered */
    }
}

3 Answers

Try this:

let kButtonSize = CGSize(width: 500, height: 100)
let button = SKSpriteNode(color: SKColor.blueColor(), size: kButtonSize)

        button.position = CGPointMake(500, 270)
        self.addChild(button)
Stone Preston
Stone Preston
42,016 Points

in the debug console there should be some more information. can you post what you find there. what you currently provided does not really say anything about whats causing the error

Eduardo Rojas
Eduardo Rojas
4,084 Points

CompileSwiftSources normal i386 com.apple.xcode.tools.swift.compiler cd "/Users/eduardoRojas/Desktop/moveThemNow/Move them NOW" export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -target i386-apple-ios8.0 -module-name Move_them_NOW -Onone -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -g -module-cache-path /Users/eduardoRojas/Library/Developer/Xcode/DerivedData/ModuleCache -I /Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Products/Debug-iphonesimulator -F /Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Products/Debug-iphonesimulator -c -j4 /Users/eduardoRojas/Desktop/moveThemNow/Move\ them\ NOW/Move\ them\ NOW/GameScene.swift /Users/eduardoRojas/Desktop/moveThemNow/Move\ them\ NOW/Move\ them\ NOW/GameViewController.swift /Users/eduardoRojas/Desktop/moveThemNow/Move\ them\ NOW/Move\ them\ NOW/AppDelegate.swift -output-file-map /Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Intermediates/Move\ them\ NOW.build/Debug-iphonesimulator/Move\ them\ NOW.build/Objects-normal/i386/Move\ them\ NOW-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Intermediates/Move\ them\ NOW.build/Debug-iphonesimulator/Move\ them\ NOW.build/Objects-normal/i386/Move_them_NOW.swiftmodule -Xcc -I/Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Intermediates/Move\ them\ NOW.build/Debug-iphonesimulator/Move\ them\ NOW.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Intermediates/Move\ them\ NOW.build/Debug-iphonesimulator/Move\ them\ NOW.build/Move\ them\ NOW-generated-files.hmap -Xcc -I/Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Intermediates/Move\ them\ NOW.build/Debug-iphonesimulator/Move\ them\ NOW.build/Move\ them\ NOW-own-target-headers.hmap -Xcc -I/Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Intermediates/Move\ them\ NOW.build/Debug-iphonesimulator/Move\ them\ NOW.build/Move\ them\ NOW-all-target-headers.hmap -Xcc -iquote -Xcc /Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Intermediates/Move\ them\ NOW.build/Debug-iphonesimulator/Move\ them\ NOW.build/Move\ them\ NOW-project-headers.hmap -Xcc -I/Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Products/Debug-iphonesimulator/include -Xcc -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Intermediates/Move\ them\ NOW.build/Debug-iphonesimulator/Move\ them\ NOW.build/DerivedSources/i386 -Xcc -I/Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Intermediates/Move\ them\ NOW.build/Debug-iphonesimulator/Move\ them\ NOW.build/DerivedSources -Xcc -DDEBUG=1 -emit-objc-header -emit-objc-header-path /Users/eduardoRojas/Library/Developer/Xcode/DerivedData/Move_them_NOW-audmndabhobdrubgdyxfvuyolywh/Build/Intermediates/Move\ them\ NOW.build/Debug-iphonesimulator/Move\ them\ NOW.build/Objects-normal/i386/Move_them_NOW-Swift.h

Eduardo Rojas
Eduardo Rojas
4,084 Points

Is that what you expected?

Stone Preston
Stone Preston
42,016 Points

hmm not really. is there anything else you can find?

Eduardo Rojas
Eduardo Rojas
4,084 Points

No :( but I'm pretty sure the line i added to the post (the code) is the thing that is creating the error because w/o it it works fine

I could be wrong but I think you need to add a image here.

import SpriteKit

class GameScene: SKScene {
    override func didMoveToView(view: SKView) {
        /* Setup your scene here */

        var box = SKSpriteNode()
        box = SKSpriteNode(imageNamed: "yourImageName")
        box.position = CGPointMake(500, 270)


        //Change Background color
        self.backgroundColor = UIColor .blackColor()

    }

    override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
        /* Called when a touch begins */

        for touch: AnyObject in touches {

        }
    }

    override func update(currentTime: CFTimeInterval) {
        /* Called before each frame is rendered */
    }
}
Eduardo Rojas
Eduardo Rojas
4,084 Points

ok, it may be but cant i have a sprite node just filled with color, like in objective c?

I would think so. But, I can't seem to find an example online. I'll let you know if I find out, one way or the other.