2

I am currently developing an application for the iPhone with the Empty Application default. This means that the only thing created by Xcode is an AppDelegate.

The only framework imported in my .pch file is the <Foundation/Foundation.h> Framework.

This is working out for most of my application, but in some places, I would like to use SpriteKit.
Is it possible to use the SpriteKit framework in my application that uses the Empty Application default?

I'm asking this because normally, I have to specifically choose the Sprite Kit Game default when creating a new project in Xcode if I want to use SpriteKit.

The default settings. Note the difference between the Empty Application and the SpriteKit game

neowinston
  • 7,584
  • 10
  • 52
  • 83
Brian Tracy
  • 6,801
  • 2
  • 33
  • 48

3 Answers3

3

Yes this is possible.

In fact, when you select anything other than Empty Application what you get is just an empty application with everything added for the default you chose.

It just saves you the job of having to add it yourself.

Fogmeister
  • 76,236
  • 42
  • 207
  • 306
2

Yes, it's possible

#import <SpriteKit/SpriteKit.h>

- (void)viewDidLoad
{
  [super viewDidLoad];

  SKView *skView = (SKView *)self.view;
  skView.showsFPS = YES;
  skView.showsNodeCount = YES;

  MyScene *skScene = [MyScene sceneWithSize:skView.bounds.size];
  skScene.scaleMode = SKSceneScaleModeAspectFill;

  [skView presentScene:skScene];
}

In the storyboard change the class of the window's view to SKView and it should all work.

dlp
  • 581
  • 5
  • 14
  • Thanks for the response, but I am using an empty application, so there are no storyboards, and Sprite Kit isn't even imported, so this won't work. – Brian Tracy Apr 13 '14 at 21:00
1

Yes, it's absolutely possible. You will just have to add the SpriteKit framework to your empty project like any other framework and do the required setup from there. Good luck!

user2105505
  • 686
  • 1
  • 9
  • 18