Anybody have a code in swift to make camera follow the player?
Whether to create camera node, like:<br />
var camera = SKSpriteNode() ?
The above answer is actually wrong, Apple docs provides you with a whole implementation for a camera node (although I've always read it through Objective-C). I'll link you, and others, to the doc in this answer so you can learn it instead of just copy and pasting some code. Hope this helps!
<a href="https://developer.apple.com/library/prerelease/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Actions/Actions.html" rel="nofollow">https://developer.apple.com/library/prerelease/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Actions/Actions.html</a>Answer2:
Apple's <a href="https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/CodeExplainedAdventure/AdventureArchitecture/AdventureArchitecture.html#//apple_ref/doc/uid/TP40013140" rel="nofollow">Adventure</a> game which is the reference implementation for Spritekit has some great code and explanations on "Moving the Camera". It is objective-c but the concepts and code are portable.Answer3:
No, there is no camera-like node. But you can simulate it if you move the background instead of the player.
So if the player walks to the right, the background moves and the player stays at the same place.