How to create a boundary in Sprite Kit

ios, ipad, iphone, sprite-kit

Solution

Define `physicsBody` for `SKScene`:

self.physicsBody = [SKPhysicsBody bodyWithEdgeLoopFromRect:self.frame];

Described well in Apple's documentation, Listing 8-1

Problem

Just started making a game using sprite kit and what i need to know is how do i set up a boundary so my character stays on the screen,as in doesn't fall away due to gravity and doesn't float away when you tap the screen enough.

Original source