Swiftpack.co -  txaiwieser/TWSpriteKitUtils as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
txaiwieser/TWSpriteKitUtils
TWControls - Simple Controls (Button, Switch) for SpriteKit, written in Swift!
.package(url: "https://github.com/txaiwieser/TWSpriteKitUtils.git", from: "2.1.0")

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

GitHub

link
Stars: 54
Last commit: 4 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

4 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics