Swift 2.0 errors


#1

@PaulSolt and anyone else,
Just trying to update my project to Swift 2.0 with xCode 7 Beta 2.

I had this line:

if contact.bodyA != nil { if contact.bodyB != nil {

However now it’s not being accepted with the following error:

Binary operator '&&' cannot be applied to two Bool operands 

Ideas ?


#2

If anyone else gets this, Apple changed it so physicsbodies on contact are no longer an optional.
How we are going to deal with multi-collisions…no idea… :confused:


#3

I also noticed that there are some bugs with Swift 2 + SpriteKit.

  1. SKRenderNode doesn’t work on the iOS Simulator, so I only see tail jet on real iPhone devices.
  2. The SKEmitterNode doesn’t advance in time.

I’ve submitted bug reports for both of these things. For now I’m going to stick to Swift 1.2 + Xcode 6 for game development.


#4

Thanks. I don’t necessarily think that’s a bug, but I feel there is a gap if you use the contact delegate with multi-collisions situations. I am afraid maybe Apple are trying to step away from this delegate ?
I think I might have to slowly redo all my code and replace the contact delegate methods with enumerate and calculate distance methods. I’ve always wondered why people in general use these, but now I see that it might be because the contact delegate has some problems :slight_smile:
I don’t see problem in games where you don’t have removal of objects though.


#5

@PaulSolt , I have a problem where the app would crash as it cannot find the images that are in the image assets. If I use just an image located in the bundle it’s fine. Ideas ?


#6

There’s a bug with images not loading correctly from projects before Xcode 7. You can re-add the asset and it should work from Asset Catalog.

Otherwise the workaround I found was to append .png or .jpg depending on the file name. For some reason it’s not working in Xcode 7 Beta 2 (last one I tried).


#7

Thanks ! Couldn’t find any other solution as well…