All Projects → bwide → Collectionnode

bwide / Collectionnode

Licence: mit
a collectionView made for Sprite Kit

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Collectionnode

Rskcollectionviewretractablefirstitemlayout
A light-weight UICollectionViewFlowLayout subclass that allows the first item to be retractable.
Stars: ✭ 281 (+192.71%)
Mutual labels:  collection, view, collectionview
Stevia
🍃 Concise Autolayout code
Stars: ✭ 3,182 (+3214.58%)
Mutual labels:  xcode, carthage, view
Bouncylayout
Make. It. Bounce.
Stars: ✭ 4,035 (+4103.13%)
Mutual labels:  collection, view, collectionview
Bfkit Swift
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.
Stars: ✭ 963 (+903.13%)
Mutual labels:  xcode, carthage
Quiver
Validation, searching and filtering made easy for swift.
Stars: ✭ 27 (-71.87%)
Mutual labels:  xcode, carthage
Instories
iOS app for viewing Instagram stories anonymously.
Stars: ✭ 31 (-67.71%)
Mutual labels:  xcode, view
Cyltabbarcontroller
[EN]It is an iOS UI module library for adding animation to iOS tabbar items and icons with Lottie, and adding a bigger center UITabBar Item. [CN]【中国特色 TabBar】一行代码实现 Lottie 动画TabBar,支持中间带+号的TabBar样式,自带红点角标,支持动态刷新。【iOS13 & Dark Mode & iPhone XS MAX supported】
Stars: ✭ 6,605 (+6780.21%)
Mutual labels:  xcode, view
Imagecoordinatespace
UICoordinateSpace for UIImageView image
Stars: ✭ 42 (-56.25%)
Mutual labels:  xcode, carthage
Tangramkit
TangramKit is a powerful iOS UI framework implemented by Swift. It integrates the functions with Android layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView
Stars: ✭ 984 (+925%)
Mutual labels:  xcode, view
Swiftymessenger
Swift toolkit for passing messages between iOS apps and extensions.
Stars: ✭ 48 (-50%)
Mutual labels:  xcode, carthage
Corenavigation
📱📲 Navigate between view controllers with ease. 💫 🔜 More stable version (written in Swift 5) coming soon.
Stars: ✭ 69 (-28.12%)
Mutual labels:  xcode, carthage
Kvconstraintkit
An Impressive Auto Layout DSL for iOS, tvOS & OSX. & It is written in pure swift.
Stars: ✭ 91 (-5.21%)
Mutual labels:  carthage, view
Modelassistant
Elegant library to manage the interactions between view and model in Swift
Stars: ✭ 26 (-72.92%)
Mutual labels:  view, collectionview
Swiftlyext
SwiftlyExt is a collection of useful extensions for Swift 3 standard classes and types 🚀
Stars: ✭ 31 (-67.71%)
Mutual labels:  xcode, carthage
Bfkit
BFKit is a collection of useful classes and categories to develop Apps faster.
Stars: ✭ 811 (+744.79%)
Mutual labels:  xcode, carthage
Swiftysound
SwiftySound is a simple library that lets you play sounds with a single line of code.
Stars: ✭ 995 (+936.46%)
Mutual labels:  xcode, carthage
Luautocompleteview
Highly configurable autocomplete view that is attachable to any UITextField
Stars: ✭ 55 (-42.71%)
Mutual labels:  xcode, carthage
Loadingshimmer
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
Stars: ✭ 1,180 (+1129.17%)
Mutual labels:  xcode, carthage
Xmlmapper
A simple way to map XML to Objects written in Swift
Stars: ✭ 90 (-6.25%)
Mutual labels:  xcode, carthage
Swiftinstagram
Instagram API client written in Swift
Stars: ✭ 570 (+493.75%)
Mutual labels:  xcode, carthage

CollectionNode

Carthage compatible Badge w/ Version MIT Swift 4.0.x Build Status

A collectionView made for Sprite Kit

Preview

installation

Carthage

Carthage is a dependency manager that provides binary frameworks for your projects.

you can install Carthage through Homebrew, with the following command:

$ brew update
$ brew install carthage

Then you need to tell carthage to integrate this framework in your Xcode project, by adding the following to your Cartfile:

github "bwide/CollectionNode"

Now:

  1. On your project folder, run carthage update
  2. On your application target, drag BWCollectionView.framework into your Xcode project Embedded Binaries

CocoaPods

Add this to your Podfile

pod 'CollectionNode'

important

If you plan to upload your app you must follow additional instructions on Carthage's README on adding frameworks to your application if you're building for iOS, tvOS, or watchOS.

usage

  1. Import CollectionNode module on your CollectionNodeScene class:
import CollectionNode
  1. Add a CollectionNode to CollectionNodeScene and set it's dataSource and Delegate:
private var myCollectionNode: CollectionNode!

override func didMove(to view: SKView) {
    myCollectionNode = CollectionNode(at: view)

    myCollectionNode.dataSource = self
    myCollectionNode.delegate = self

    addChild(myCollectionNode)
}
  1. Conform this CollectionNodeScene to CollectionNodeDataSource and implement all it's methods:
extension GameScene: CollectionNodeDataSource {
    func numberOfItems() -> Int {
        return EmojiModel.default.emojis.count
    }

    func collectionNode(_ collection: CollectionNode, itemFor index: Index) -> CollectionNodeItem {
        //create and configure items
        let item = EmojiItem()
        item.emoji = EmojiModel.default.emojis[index]
        return item
    }
}
  1. Conform to CollectionNodeDelegateand override the methods that you need:
extension GameScene: CollectionNodeDelegate {

     func collectionNode(_ collectionNode: CollectionNode, didShowItemAt index: Index) {
        let growAction = SKAction.scale(to: 1.3, duration: 0.15)
        let shrinkAction = SKAction.scale(to: 1, duration: 0.15)

        collectionNode.item(at: index).run(growAction)
        collectionNode.children.filter{ emojiCollection.children.index(of: $0) != index }.forEach{ $0.run(shrinkAction) }
    }

    func collectionNode(_ collectionNode: CollectionNode, didSelectItem item: CollectionNodeItem, at index: Index) {
        print("selected \(item.name ?? "noNameItem") at index \(index)")
    }
}
  1. Update your CollectionNode with the scene:
override func update(_ currentTime: TimeInterval) {
    collectionNode.update(currentTime)
}
  1. Now CollectionNodewill work with it's default implementation.

Properties

private(set) public var index: Int

the current index of the CollectionNode

public weak var dataSource: CollectionNodeDataSource?

the object that acts as data source for the collection view

public weak var delegate: CollectionNodeDelegate?

the object that acts as delegate for the collection view

public var spaceBetweenItems: CGFloat

the spacing between elements of the CollectionNode

public var items: [CollectionNodeItem]

returns all the children of this node that are CollectionNodeItems

Methods

public func update(_ currentTime: TimeInterval, dampingRatio: Double)

To be called on the scene's update. Allows this node to animate when touch is released dampingRatio: the ratio for the collectionNode deacceleration (0 to 1 meaning the percentage of speed to deaccelerate when touch is released, default is 1%)

public func snap(to index: Index, withDuration duration: Double)

snaps to an item at a given index duration: The duration of the snap animation in seconds (default is 0.3)

public func reloadData()

reloads all the items in the collection

CollectionNodeDelegate

func collectionNode(_ collectionNode: CollectionNode, didShowItemAt index: Index) -> Void

returns the number of items to be displayed on this collectionNode

func collectionNode(_ collectionNode: CollectionNode, didSelectItem item: CollectionNodeItem, at index: Index ) -> Void

called each time an item is selected

CollectionNodeDataSource

func numberOfItems() -> Int

here you should tell the number of items this collection will display

func collectionNode(_ collection: CollectionNode, itemFor index: Index) -> CollectionNodeItem

here you should return an item for each index in the collectionVIew

Apps using CollectionNode

Preview

Show me your apps! if you have used this collection i'd love to see it, reach me in [email protected] you can send me images and i will post them here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].