Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Latest commit

 

History

History
65 lines (52 loc) · 1.52 KB

README.md

File metadata and controls

65 lines (52 loc) · 1.52 KB

SpriteKit Utils - Buttons, Switches, Stacks and Collections for SpriteKit!

Easy to use SpriteKit controls

  • TWButton: A SKSpriteNode subclass that implements commom button funcionalities (similar to UIKit's UIButton).
  • TWSwitch: A SKSpriteNode subclass that implements commom switch funcionalities (similar to UIKit's UISwitch).
  • TWStack: A SKSpriteNode subclass that implements commom stack funcionalities (similar to UIKit's UIStackView).
  • TWCollection: A SKSpriteNode subclass that implements commom collection funcionalities (similar to UIKit's UICollectionView).

Demonstration

Here's a full init code snippet:

TWButton

let colorButton = TWButton(
    size: CGSize(width: 102, height: 40),
    normal: .blue,
    highlighted: .yellow,
    disabled: .gray
)

colorButton.addClosure(.touchUpInside) { [unowned self] _ in
    // Action
}

TWSwitch

let colorSwitch = TWSwitch(
    size: CGSize(width: 102, height: 40),
    normal: .blue,
    highlighted: .yellow,
    selected: .green,
    disabled: .gray
)

colorSwitch.addClosure(.selectionChanged) { [unowned self] _ in
    // Action
}

TWStackNode

let stackNode = TWStackNode(
    fillMode: .vertical,
    sizingMode: .dynamic(spacing: 8)
)

TWCollectionNode

let collectionNode = TWCollectionNode(
    fillMode: .init(
	columnsCount: 3,
	lineSpacing: 30,
	elementSize: CGSize(width: 100, height: 100)
    )
)

License

See LICENSE for more information