All Projects → dasdom → Breakouttorefresh

dasdom / Breakouttorefresh

Licence: mit
Play BreakOut while loading - A playable pull to refresh view using SpriteKit

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Breakouttorefresh

Legend Wings
iOS Swift Game - Push SpriteKit to the limit
Stars: ✭ 481 (-80.49%)
Mutual labels:  spritekit
Arkitgamespritekit
A game inspired by Pokemon Go build with ARKit and SpriteKit
Stars: ✭ 87 (-96.47%)
Mutual labels:  spritekit
Life Calendar
A look at the big picture.
Stars: ✭ 139 (-94.36%)
Mutual labels:  spritekit
Clippy
📎💬🎉 Clippy from Microsoft Office is back and runs on macOS! Written in Swift.
Stars: ✭ 670 (-72.83%)
Mutual labels:  spritekit
2048
The iOS version of 2048, made using SpriteKit
Stars: ✭ 1,088 (-55.88%)
Mutual labels:  spritekit
Collectionnode
a collectionView made for Sprite Kit
Stars: ✭ 96 (-96.11%)
Mutual labels:  spritekit
Glide
Game engine for making 2d games on iOS, macOS and tvOS, with practical examples and tutorials
Stars: ✭ 353 (-85.69%)
Mutual labels:  spritekit
Haskellspritekit
Haskell binding to Apple's SpriteKit framework
Stars: ✭ 165 (-93.31%)
Mutual labels:  spritekit
Magnetic
SpriteKit Floating Bubble Picker (inspired by Apple Music) 🧲
Stars: ✭ 1,252 (-49.23%)
Mutual labels:  spritekit
Rxspritekit
👾 Reactive Extensions for SpriteKit
Stars: ✭ 131 (-94.69%)
Mutual labels:  spritekit
Spritekit Leaf Simulation
A simulation of leaves blowing in the wind created with SpriteKit.
Stars: ✭ 6 (-99.76%)
Mutual labels:  spritekit
Sprite Liquids Ios App
💧Demonstrates a practical approach for liquid visualization using SpriteKit and CoreImage frameworks.
Stars: ✭ 20 (-99.19%)
Mutual labels:  spritekit
Ios Learning Materials
📚Curated list of articles, web-resources, tutorials and code repositories that may help you dig a little bit deeper into iOS [and Apple Platforms].
Stars: ✭ 1,380 (-44.04%)
Mutual labels:  spritekit
Shaderkit
A library of fragment shaders you can use in any SpriteKit project.
Stars: ✭ 488 (-80.21%)
Mutual labels:  spritekit
Sukermariobros
SukerMarioBros. — Swift + SpriteKit Super Mario Brosers "port"
Stars: ✭ 143 (-94.2%)
Mutual labels:  spritekit
Sifloatingcollection swift
iOS Swift framework for creating user interface like apple music genre selection bubbles
Stars: ✭ 424 (-82.81%)
Mutual labels:  spritekit
Activityrings
An attempt to recreate the ring controls in Apple’s Activity app
Stars: ✭ 88 (-96.43%)
Mutual labels:  spritekit
Sktiled
Swift framework for working with Tiled assets in SpriteKit
Stars: ✭ 208 (-91.57%)
Mutual labels:  spritekit
Flappy Fly Bird
🐦 Flappy Bird reincarnation [Swift 5.3, GameplayKit, SpriteKit, iOS 12].
Stars: ✭ 150 (-93.92%)
Mutual labels:  spritekit
Lifesaver
Conway's Game of Life implemented as an artistic, abstract macOS screensaver and tvOS app using SpriteKit
Stars: ✭ 113 (-95.42%)
Mutual labels:  spritekit

BreakOutToRefresh

Play BreakOut while loading - A playable pull to refresh view using SpriteKit

BreakOutToRefresh uses SpriteKit to add a playable mini game to the pull to refresh view in a table view. In this case the mini game is BreakOut but a lot of other mini games could be presented in this space.

Book

If you like this repository and like'd to give me something back, I wrote a book about funny location based projects for iOS. Please check it out: Build Location-Based Projects for iOS

Installation

CocoaPods

Add this to your Podfile:

use_frameworks!

pod 'BreakOutToRefresh'

Manual

Add BreakOutToRefreshView.swift to your project.

Usage

If you need it only once in your app, add this to your table view controller:

class DemoTableViewController: UITableViewController {

  var refreshView: BreakOutToRefreshView!
  
  // ...
  
  override func viewDidLoad() {
    super.viewDidLoad()
    
    refreshView = BreakOutToRefreshView(scrollView: tableView)
    refreshView.refreshDelegate = self
  
    // configure the refresh view
    refreshView.scenebackgroundColor = .white
    refreshView.textColor = .black
    refreshView.paddleColor = .brown
    refreshView.ballColor = .darkGray
    refreshView.blockColors = [.blue, .green, .red]
  
    tableView.addSubview(refreshView)
  }  
}

extension DemoTableViewController: UIScrollViewDelegate {
 
  override func scrollViewDidScroll(scrollView: UIScrollView) {
    refreshView.scrollViewDidScroll(scrollView)
  }
  
  override func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
    refreshView.scrollViewWillEndDragging(scrollView, withVelocity: velocity, targetContentOffset: targetContentOffset)
  }
  
  override func scrollViewWillBeginDragging(scrollView: UIScrollView) {
    refreshView.scrollViewWillBeginDragging(scrollView)
  }
}

extension DemoTableViewController: BreakOutToRefreshDelegate {
  
  func refreshViewDidRefresh(refreshView: BreakOutToRefreshView) {
    // load stuff from the internet
  }

}

In case you need it more than once in your app, add the setup to viewWillAppear and clean up in viewWillDisappear like this:

override func viewWillAppear(_ animated: Bool) {
  super.viewWillAppear(animated)
  
  refreshView = BreakOutToRefreshView(scrollView: tableView)
  refreshView.refreshDelegate = self
  
  // configure the refresh view
  refreshView.scenebackgroundColor = .white
  refreshView.textColor = .black
  refreshView.paddleColor = .brown
  refreshView.ballColor = .darkGray
  refreshView.blockColors = [.blue, .green, .red]
  
  tableView.addSubview(refreshView)
}

override func viewWillDisappear(_ animated: Bool) {
  super.viewWillDisappear(animated)
  
  refreshView.removeFromSuperview()
  refreshView = nil
}

When the loading of new content is finished, call endRefreshing() of the refreshView.

When endRefreshing() is called the mini game doesn't stop immediately. The game stops (and the view is dismissed) when the user lifts the finger. If you like to end the mini game immediately set the forceEnd property to true.

Status

It's kind of beta status.

Feedback

If you use this code or got inspired by the idea and build an app with an even more awesome PullToRefresh game, please let me know.

Author

Dominik Hauser

Twitter: @dasdom

dasdom.github.io

Support

If you want to give me something back, I would highly appreciate if you buy my book about Test-Driven Development with Swift and give me feedback about it.

Thanks

Thanks to Ben Oztalay and raywenderlich.com for inspiration.

Licence

MIT

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].