Swift 2.0 and Sprite Kit Basics for Game Developers

Learn the basics of Swift 2.0 and Sprite Kit. Included are past lessons for Swift 1 which still apply.
3.8 (44 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
7,277 students enrolled
25% off
Take This Course
  • Lectures 35
  • Length 6 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 10/2014 English

Course Description

In the Swift Basics section of video tutorials, I’ll teach some of the basic things you can do with Swift in Xcode. If you’re completely new to programming or just need a little refresher, this is a great starter tutorial series, and it is all completely free.

In the Swift and Sprite Kit section, you can follow right along with me during my first week with Sprite Kit and Swift. Although, I’m quite comfortable behind the wheel with Sprite Kit, these videos were recorded over my first 5 days with Swift, so this series is a bit more off-the-cuff, experimental, and reveals some of my initial “ah-ha” moments with the language.

What are the requirements?

  • Have Xcode 6 or 6.1
  • Use a Mac, preferably with Yosemite but not required

What am I going to get from this course?

  • Feel comfortable with common programming terms in Swift
  • Create functions, variables, and work with different types
  • Be able to import image assets and work in a simple Sprite Kit based physics environment

Who is the target audience?

  • No prior programming knowledge is needed
  • Anyone who wants a refresher in some general programming topics with Swift

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Swift 2.0 Basics
Swift 2.0 - Variables and Optionals
Swift 2.0 Functions and Returning Values
Swift 2.0 Enum types and Switch Statements
Swift 2.0 Iterating through Arrays
Swift 2.0 Looking up keys and values in a Dictionary
Section 2: Swift 2.0 with Sprite Kit in Xcode 7
SpriteKit & Swift 2.0 Tutorial - Importing Images and Safe Casting
SpriteKit & Swift 2.0 Tutorial - Enumerating all children (even in SKReferences)
SpriteKit & Swift 2.0 Tutorial - Subclassing with the new Custom Class Inspector
SpriteKit & Swift 2.0 Tutorial - Physics & using SKCameraNode to track a node
SpriteKit & Swift 2.0 Tutorial - SKActions, in particular RunBlock
SpriteKit & Swift 2.0 Tutorial - Detecting collisions with SKPhysicsContacts
More Gaming Resources
Section 3: Swift 1.0 Basics (recorded in the not-so-distant past, so it still applies)

In these video tutorials I’ll be teaching some of the basics of Swift in Xcode. This lesson we’ll look at simply opening Xcode and creating a Swift based Sprite project.

Variables, Optionals and More

This video we’ll look at writing a function (or the thing formally known as "methods" in Objective C), passing a parameter into it, and returning a value from the function.


This lesson we’ll look at if statements, if…else statements, bool variables, and how to create a variable in an if statement when an optional does not equal nil. For example…

if let siteName = siteToPlug {




This lesson we’ll look at enumerations and switch statements


This tutorial we’ll look at the Swift way of making Arrays and iterating through either with a for loop.


This tutorial we’ll look at the Swift way of making Dictionaries and iterating through either with a for loop.


This tutorial we'll look at creating Classes (and briefly Structs).


This tutorial we'll look at adding initializers to our class from the previous lesson.


This tutorial we'll look briefly at creating a subclass of an Enemy class.

Section 4: Swift 1.0 and SpriteKit (recorded in the not-so-distant past)

In this series, I'll be documenting my first 5 days using Swift. The highs, the lows, the "ah-ha" moments, it'll all be here. Although I'm no novice to game programming (I've written a book, recorded hundreds of hours of programming tutorials and created an iOS game engine), this is a brand new programming language for me too. I'll be using Swift and Sprite Kit, so for you budding game developers out there, this is a great primer series to get you started on the road to making your first app.


This continues right where the first video from Day 1 leaves off.


In this video, we'll play around with some of the physics using Swift and Sprite Kit.


Its now my 3rd day with Swift, and in this video, I'll start a new project, bring in new art assets, and discuss enum types, and look at how we could use them to examine different states of a game character or enemy. If you feel comfortable with setting up your Swift-based project already feel free to skip to around the 6:00 mark.


We'll look at testing class types, using the update function in the main game scene class to update other classes and cycling through various states with different SKTextures. Sound fun? Hit Play.


In this video, we'll continue right where we left off in the previous video and enumerate through all children in the scene during the update statement


In this video we will play around with moving sprite during the update statement when we tap the screen and also change textures depending on the current state.


In Day 4 of this series, we will look at creating a Dictionary to pass into a subclass of SKNode which we'll use as a platform for our game character to fall onto (and kind of walk along).


We will continue by subclassing SKNode for our platform


Continuing from the previous video, we'll create multiple instances of the platform using a for loop.


Continuing from the previous video, we'll now add an SKPhysicsBody for each sprite and trigger them to switch from dynamic to non-dynamic from the main Game Scene class.


Day 5, In this video we'll look at creating collision / contact listeners in the GameScene class. This will enable us to test when two objects have collided with each other (or through each other). We'll look at code specifics such as SKPhysicsContactDelegate, categoryBitMask, collisionBitMask, contactBitMask and plenty more.

Update: toRaw() is now rawValue in Xcode 6.1. The compiler will prompt you to change it.

Day 5 - More testing with the Contact Delegate

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Justin Dike, CartoonSmart / Owner / Leader Developer and Instructor

Justin Dike is the founder of CartoonSmart one of the internet's first video training websites. He is a long-time illustrator and animator, focusing mostly on Adobe Flash, and experienced programmer with Swift, Sprite Kit, Actionscript 3, Objective C and Cocos2d. For CartoonSmart he has recorded hundreds of hours of video tutorials and recently published his first full length book titled iOS Programming with Xcode and Cocos2d available in the iBookstore. Justin has also developed many iOS games, including a side scrolling game engine.

Ready to start learning?
Take This Course