Swiftpack.co - txaiwieser/TWSpriteKitUtils as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by txaiwieser.
txaiwieser/TWSpriteKitUtils 2.1.0
TWControls - Simple Controls (Button, Switch) for SpriteKit, written in Swift!
⭐️ 53
🕓 2 years ago
iOS macOS watchOS
.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: 53
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

[Swift 5] Components refactor
2 years ago

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