Latest 1.0.2
License MIT
Platforms ios 8.0

Analog joysticks for iOS written in Swift.

This repository contains a sample app in addition to Cocoapod. To try out SwiftSticks quickly, clone this repository, run pod install, and run the app target.


For Cocoapods, add the following to your Podfile:

pod 'SwiftSticks'

Install with pod install.

This repo also contains a quick demo application. Clone the repo, open the project, and run the SwiftSticks-Example target. See sample implementation in the main ViewController.


There’s one main class in this project, the StickView. Add it to your views in any of the usual ways– add a StickView subclass in InterfaceBuilder, or create an instance programmatically:

import SwiftSticks


// Abbreviated example
let sticks = StickView(frame: someFrame)

The actual rendering of the stick, which is a SpriteKitNode, will always size itself initially based on the size of the StickView. Note that resizing is not currently supported.


Delegate handlers:

@IBOutlet weak var stickView: StickView!


// Called as the user drags the stick around
stickView.didMove = { (a: AnalogJoystickData) -> () in

// Called when the user first touches the joystick and starts dragging it around
stickView.startedMoving = {
    print("Stick started moving")

// Called when the user stops touching the stick
stickView.stoppedMoving = {
    print("Stopped moving")

Position data is returned as AnalogJoystickData structs which have two fields: position and angle.. Position is recorded from -1 to +1 along the x and y axes. angle is measured in radians starting at the 12 o’clock position and increasing positive in the counter-clockwise direction and negative clockwise. I didn’t set this part of the library up, and lord knows why its done like this, so if it bothers you enough please submit a PR.

Data // => returns currentAnalogJoystickData  

stickView.isMoving // => true if the user is currently dragging the joystick


// Turn sticks on or off
stickView.disabled = true 

// Set the color of the stick or the base
stickView.stickColor = UIColor.white()
stickView.baseColor =

// Use images for the stick
stickView.stickImage = UIImage(named: "YourImage")
stickView.baseImage = UIImage(named: "YourOtherImage")


Started as a fork of this project by MitrophD.


  • Create an IBAction delegate for the stick views
  • Refactor the handlers appropriately
  • Add constraints between the stickview and the SKView to resize appropriately

Latest podspec

    "name": "SwiftSticks",
    "version": "1.0.2",
    "summary": "A short description of SwiftSticks.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Mickey Barboi": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.2"
    "platforms": {
        "ios": "8.0"
    "source_files": "SwiftSticks/Classes/**/*",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This