# How to Make a Game Like Candy Crush with SpriteKit and Swift: Part 2

**URL:** <https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448>\
**Category:** 🎓 Courses & Articles\
**Created:** [June 1, 2016, 1:06pm UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448 "2016-06-01T13:06:20Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfaarkrog](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mfaarkrog/32/95881_2.png) [@mfaarkrog](https://forums.kodeco.com/u/mfaarkrog)\
**Post date:** [June 1, 2016, 1:06pm UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/1 "2016-06-01T13:06:20Z")

</div>

In this epic tutorial you'll learn how to make a tasty match-3 game like Candy Crush with SpriteKit and Swift. Now updated for Xcode 7.3 and Swift 2.2.

* * *
 This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/1118-how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2](https://www.raywenderlich.com/1118-how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2)

---

<div class="post-metadata">

**Author:** ![tinykid](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/tinykid/32/81494_2.png) [@tinykid](https://forums.kodeco.com/u/tinykid)\
**Post date:** [June 13, 2016, 12:20am UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/2 "2016-06-13T00:20:25Z")

</div>

Another great tutorial filled with good stuff! Moving on to the third one right now!

---

<div class="post-metadata">

**Author:** ![quillpro](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/quillpro/32/59355_2.png) [@quillpro](https://forums.kodeco.com/u/quillpro)\
**Post date:** [July 21, 2016, 5:45pm UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/3 "2016-07-21T17:45:36Z")

</div>

I am a little confused by the use of **private** when referring to a property. Your instructions asks for a private property but does not use the `private` keyword and vise versa. Can you clarify the use?

Example  
Go to GameScene.swift and add two **private properties** to the class:  
`var swipeFromColumn: Int?`  
`var swipeFromRow: Int?`

In Level.swift, add a new property:  
`private var possibleSwaps = Set<Swap>()`

Thanks

---

<div class="post-metadata">

**Author:** ![mfaarkrog](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mfaarkrog/32/95881_2.png) [@mfaarkrog](https://forums.kodeco.com/u/mfaarkrog)\
**Post date:** [July 22, 2016, 6:05pm UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/4 "2016-07-22T18:05:14Z")

</div>

Hey :] Nicely spotted! This is a typo and I’ll fix it straight away – the properties should be `private` :]

---

<div class="post-metadata">

**Author:** ![witt](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/witt/32/43025_2.png) [@witt](https://forums.kodeco.com/u/witt)\
**Post date:** [October 1, 2016, 8:59am UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/5 "2016-10-01T08:59:03Z")

</div>

'Add Sound Efffects ’ – Efffects → Effects

---

<div class="post-metadata">

**Author:** ![azcoder](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/azcoder/32/69717_2.png) [@azcoder](https://forums.kodeco.com/u/azcoder)\
**Post date:** [October 15, 2016, 4:24am UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/6 "2016-10-15T04:24:56Z")

</div>

I’ve been implementing this step-by-step in Swift 2.3. You listed output at one point as:

```
possible swaps: [
swap type:SugarCookie square:(6,5) with type:Cupcake square:(7,5): true,
swap type:Croissant square:(3,3) with type:Macaroon square:(4,3): true,
swap type:Danish square:(6,0) with type:Macaroon square:(6,1): true,
swap type:Cupcake square:(6,4) with type:SugarCookie square:(6,5): true,
swap type:Croissant square:(4,2) with type:Macaroon square:(4,3): true,

```

However, I have not been able to find in the code how you outputted the “true” anywhere. I even downloaded your code at this stage, but unless I’m going blind, I don’t see it.

Thanks for this tutorial, by the way (and thanks to the original blogger as well). Learning a lot!

---

<div class="post-metadata">

**Author:** ![mfaarkrog](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mfaarkrog/32/95881_2.png) [@mfaarkrog](https://forums.kodeco.com/u/mfaarkrog)\
**Post date:** [October 15, 2016, 8:09am UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/7 "2016-10-15T08:09:25Z")

</div>

Hey @azcoder :] Thanks for your comment. You’re right – the `true` should be removed from the output. I’ll fix it straight away. Hope you’ll enjoy the rest of the series. Also note that the tutorial series was updated for Swift 3 (just in case you’re still using 2.3) :]

---

<div class="post-metadata">

**Author:** ![azcoder](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/azcoder/32/69717_2.png) [@azcoder](https://forums.kodeco.com/u/azcoder)\
**Post date:** [October 15, 2016, 4:33pm UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/8 "2016-10-15T16:33:08Z")

</div>

Thanks, Morten! Yes, I haven’t migrated my environment to Swift 3 yet, so I’ve been revising your code for Swift 2.3 compatibility. This is helping me see what changes I’ll need to be aware of when I do change over. 😀

---

<div class="post-metadata">

**Author:** ![mfaarkrog](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mfaarkrog/32/95881_2.png) [@mfaarkrog](https://forums.kodeco.com/u/mfaarkrog)\
**Post date:** [October 15, 2016, 4:45pm UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/9 "2016-10-15T16:45:43Z")

</div>

Sounds good :] Let me know if you need the Swift 2 version for any of the parts – I still have that stored locally from before I updated the series to Swift 3.

---

<div class="post-metadata">

**Author:** ![bush](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bush/32/62452_2.png) [@bush](https://forums.kodeco.com/u/bush)\
**Post date:** [December 29, 2016, 12:54am UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/10 "2016-12-29T00:54:50Z")

</div>

Great tutorial! I am having an issue in the touchesMoved method. It is telling me that locationInNode has been renamed to location(in:), and then right below that where I declare (success, column, row) = convertPoint(location), I get the error Argument labels ‘(\_:)’ do not match any available overloads.

---

<div class="post-metadata">

**Author:** ![liberatordg](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/liberatordg/32/81494_2.png) [@liberatordg](https://forums.kodeco.com/u/liberatordg)\
**Post date:** [February 11, 2017, 12:18pm UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/11 "2017-02-11T12:18:47Z")

</div>

@bush that is something that changed in **Swift 3.0.1!**  
You can easily click on the first error and then on “fix it”. Swift will change it to Swift 3.0.1 syntax.

The “Argument labels” error can be fixed by replacing **convertPoint(location)** with **convertPoint(point: location)**.

By the way, this tutorial is really great! Thanks a lot!

The complete function:

> override func touchesMoved(\_ touches: Set, with event: UIEvent?) {  
> guard swipeFromColumn != nil else { return }
> 
> ```
> guard let touch = touches.first else { return }
> let location = touch.location(in: cookiesLayer)
>     
> let (success, column, row) = convertPoint(point: location)
> if success {
>         
> var horzDelta = 0, vertDelta = 0
> if column < swipeFromColumn! { // swipe left
> horzDelta = -1
> } else if column > swipeFromColumn! { // swipe right
> horzDelta = 1
> } else if row < swipeFromRow! { // swipe down
> vertDelta = -1
> } else if row > swipeFromRow! { // swipe up
> vertDelta = 1
> }
>         
> if horzDelta != 0 || vertDelta != 0 {
> trySwap(horizontal: horzDelta, vertical: vertDelta)
>             
> swipeFromColumn = nil
> }
> }
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [October 16, 2017, 12:35pm UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/12 "2017-10-16T12:35:14Z")

</div>

This tutorial is more than six months old so questions regarding it are no longer supported for the moment. We will update it as soon as possible. Thank you! :]

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [October 16, 2017, 12:35pm UTC](https://forums.kodeco.com/t/how-to-make-a-game-like-candy-crush-with-spritekit-and-swift-part-2/15448/13 "2017-10-16T12:35:18Z")

</div>

Closed on October 16, 2017, 12:35pm UTC


