{"id":2713,"url":"https://github.com/dasdom/BreakOutToRefresh","last_synced_at":"2025-08-06T14:32:51.649Z","repository":{"id":26016268,"uuid":"29458939","full_name":"dasdom/BreakOutToRefresh","owner":"dasdom","description":"Play BreakOut while loading - A playable pull to refresh view using SpriteKit","archived":false,"fork":false,"pushed_at":"2020-06-09T17:35:51.000Z","size":3671,"stargazers_count":2477,"open_issues_count":2,"forks_count":141,"subscribers_count":53,"default_branch":"master","last_synced_at":"2024-11-30T10:11:48.743Z","etag":null,"topics":["breakout","mini-game","spritekit","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dasdom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"dasdom"}},"created_at":"2015-01-19T07:27:38.000Z","updated_at":"2024-11-23T11:58:27.000Z","dependencies_parsed_at":"2022-09-02T05:23:38.121Z","dependency_job_id":null,"html_url":"https://github.com/dasdom/BreakOutToRefresh","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasdom%2FBreakOutToRefresh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasdom%2FBreakOutToRefresh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasdom%2FBreakOutToRefresh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasdom%2FBreakOutToRefresh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dasdom","download_url":"https://codeload.github.com/dasdom/BreakOutToRefresh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228592952,"owners_count":17942285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["breakout","mini-game","spritekit","swift"],"created_at":"2024-01-05T20:16:20.886Z","updated_at":"2024-12-09T15:30:48.800Z","avatar_url":"https://github.com/dasdom.png","language":"Swift","readme":"# BreakOutToRefresh\nPlay BreakOut while loading - A playable pull to refresh view using SpriteKit\n\n![](https://raw.githubusercontent.com/dasdom/BreakOutToRefresh/master/Example/PullToRefreshDemo/what.gif)\n\nBreakOutToRefresh 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.\n\n## Book\n\nIf 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](https://pragprog.com/book/dhios/build-location-based-projects-for-ios)\n\n## Installation\n\n### CocoaPods\n\nAdd this to your Podfile:\n\n```\nuse_frameworks!\n\npod 'BreakOutToRefresh'\n```\n\n### Manual\n\nAdd **BreakOutToRefreshView.swift** to your project.\n\n## Usage\n\nIf you need it only once in your app, add this to your table view controller:\n```swift\nclass DemoTableViewController: UITableViewController {\n\n  var refreshView: BreakOutToRefreshView!\n  \n  // ...\n  \n  override func viewDidLoad() {\n    super.viewDidLoad()\n    \n    refreshView = BreakOutToRefreshView(scrollView: tableView)\n    refreshView.refreshDelegate = self\n  \n    // configure the refresh view\n    refreshView.scenebackgroundColor = .white\n    refreshView.textColor = .black\n    refreshView.paddleColor = .brown\n    refreshView.ballColor = .darkGray\n    refreshView.blockColors = [.blue, .green, .red]\n  \n    tableView.addSubview(refreshView)\n  }  \n}\n\nextension DemoTableViewController: UIScrollViewDelegate {\n \n  override func scrollViewDidScroll(scrollView: UIScrollView) {\n    refreshView.scrollViewDidScroll(scrollView)\n  }\n  \n  override func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer\u003cCGPoint\u003e) {\n    refreshView.scrollViewWillEndDragging(scrollView, withVelocity: velocity, targetContentOffset: targetContentOffset)\n  }\n  \n  override func scrollViewWillBeginDragging(scrollView: UIScrollView) {\n    refreshView.scrollViewWillBeginDragging(scrollView)\n  }\n}\n\nextension DemoTableViewController: BreakOutToRefreshDelegate {\n  \n  func refreshViewDidRefresh(refreshView: BreakOutToRefreshView) {\n    // load stuff from the internet\n  }\n\n}\n```\n\nIn case you need it more than once in your app, add the setup to `viewWillAppear` and clean up in `viewWillDisappear` like this:\n\n```swift\noverride func viewWillAppear(_ animated: Bool) {\n  super.viewWillAppear(animated)\n  \n  refreshView = BreakOutToRefreshView(scrollView: tableView)\n  refreshView.refreshDelegate = self\n  \n  // configure the refresh view\n  refreshView.scenebackgroundColor = .white\n  refreshView.textColor = .black\n  refreshView.paddleColor = .brown\n  refreshView.ballColor = .darkGray\n  refreshView.blockColors = [.blue, .green, .red]\n  \n  tableView.addSubview(refreshView)\n}\n\noverride func viewWillDisappear(_ animated: Bool) {\n  super.viewWillDisappear(animated)\n  \n  refreshView.removeFromSuperview()\n  refreshView = nil\n}\n```\n\nWhen the loading of new content is finished, call `endRefreshing()` of the `refreshView`.\n\nWhen `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.\n\n## Status\n\nIt's kind of beta status.\n\n## Feedback\n\nIf 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.\n\n## Author\n\nDominik Hauser\n\n[Twitter: @dasdom](https://twitter.com/dasdom)\n\n[dasdom.github.io](https://dasdom.github.io/)\n\n## Support\n\nIf you want to give me something back, I would highly appreciate if you buy [my book about Test-Driven Development with Swift](https://leanpub.com/tddfakebookforios) and give me feedback about it. \n\n## Thanks\n\nThanks to [Ben Oztalay](https://github.com/boztalay/BOZPongRefreshControl) and [raywenderlich.com](http://www.raywenderlich.com) for inspiration.\n\n## Licence\n\nMIT\n","funding_links":["https://github.com/sponsors/dasdom"],"categories":["UI","Libs","PullToRefresh","Swift","UI [🔝](#readme)","ALL"],"sub_categories":["Pull to Refresh","UI","Layout","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdasdom%2FBreakOutToRefresh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdasdom%2FBreakOutToRefresh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdasdom%2FBreakOutToRefresh/lists"}