{"id":2365,"url":"https://github.com/HideakiTouhara/Poi","last_synced_at":"2025-08-06T12:32:02.133Z","repository":{"id":56924299,"uuid":"122947225","full_name":"HideakiTouhara/Poi","owner":"HideakiTouhara","description":null,"archived":false,"fork":false,"pushed_at":"2020-03-25T07:44:39.000Z","size":19152,"stargazers_count":67,"open_issues_count":0,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-01T03:25:15.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/HideakiTouhara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-26T09:39:15.000Z","updated_at":"2024-10-29T15:34:57.000Z","dependencies_parsed_at":"2022-08-21T05:20:37.561Z","dependency_job_id":null,"html_url":"https://github.com/HideakiTouhara/Poi","commit_stats":null,"previous_names":["hideakitouhara/tindercard"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HideakiTouhara%2FPoi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HideakiTouhara%2FPoi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HideakiTouhara%2FPoi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HideakiTouhara%2FPoi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HideakiTouhara","download_url":"https://codeload.github.com/HideakiTouhara/Poi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228898281,"owners_count":17988652,"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":[],"created_at":"2024-01-05T20:16:11.998Z","updated_at":"2024-12-09T13:30:35.598Z","avatar_url":"https://github.com/HideakiTouhara.png","language":"Swift","funding_links":[],"categories":["UI","Libs","Animation [🔝](#readme)"],"sub_categories":["Animation"],"readme":"# Poi  \n[![Pod version](https://badge.fury.io/co/Poi.svg)](https://badge.fury.io/co/Poi) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE) ![Swift 4.0.x](https://img.shields.io/badge/Swift-4.0.x-orange.svg)\n\nYou can use tinder UI like tableview method\n\n![demo1](https://github.com/HideakiTouhara/Poi/blob/resources/Resources/sample_demo.gif)\n\n## Installation\n### Manual Installation\n1. Use this command\n\n```\ngit clone git@github.com:HideakiTouhara/Poi.git\n```\n\n2. Import Poi.xcodeproj to your project\n\n![direct_import1](https://github.com/HideakiTouhara/Poi/blob/resources/Resources/direct_import1.jpg)\n\n3. Add Poi.frameworkiOS to Embedded Binaries\n\n![direct_import2](https://github.com/HideakiTouhara/Poi/blob/resources/Resources/direct_import2.jpg)\n\n\n\n### Cocoa Pods\nPlease write the below code in Podfile\n\n```\npod ‘Poi’\n```\n### Carthage\nWrite this code in your Cartfile.\n\n```\ngithub \"HideakiTouhara/Poi\"\n```\n\nand implement this command\n\n```\ncarthage update\n```\n\nAdd Poi.framework in /Carthage/Build/iOS/ to Embedded Binaries.\n\n![carthage_import](https://github.com/HideakiTouhara/Poi/blob/resources/Resources/carthage_import.jpg)\n\n## Usage\nCreate PoiView in storyboard or swift file\n\n``` swift\nimport Poi\n\n@IBOutlet weak var poiView: PoiView!\n// Change View's class to PoiView in Attributes inspector.\n```\n\nor\n\n``` swift\nimport Poi\n\nlet poiView = PoiView()\nself.view.addSubView(poiView)\n```\n\nConform to PoiViewDataSource and PoiViewDelegate\n\n``` swift\nclass ViewController: UIViewController, PoiViewDataSource, PoiViewDelegate {\n```\n\nDesignate delegate target.\n\nPlease put this code after setting card contents.\n\n``` swift\npoiView.dataSource = self\npoiView.delegate = self\n```\n\n### PoiViewDataSource method\n\nSet swipeable card number(required method)\n\n``` swift\nfunc numberOfCards(_ poi: PoiView) -\u003e Int\n```\n\nSet swipeable card(required method)\n\n``` swift\nfunc poi(_ poi: PoiView, viewForCardAt index: Int) -\u003e UIView\n```\n\nSet overlay image if right or left swiped\n\n``` swift\nfunc poi(_ poi: PoiView, viewForCardOverlayFor direction: SwipeDirection) -\u003e UIImageView? {\n    switch direction {\n    case .right:\n        return UIImageView(image: #imageLiteral(resourceName: \"good\"))\n    case .left:\n        return UIImageView(image: #imageLiteral(resourceName: \"bad\"))\n    }\n}\n```\n\n### PoiViewDelegate method\n\nWhen did swipe, this method is called\n\n``` swift\nfunc poi(_ poi: PoiView, didSwipeCardAt: Int, in direction: SwipeDirection)\n```\n\nWhen last card was swiped, this method is called\n\n``` swift\nfunc poi(_ poi: PoiView, runOutOfCardAt: Int, in direction: SwipeDirection)\n```\n\n### Public method\n\nSwipe current card\n\n``` swift\nfunc swipeCurrentCard(to direction: SwipeDirection)\n```\n\nUndo animation and go back previous card\n\n``` swift\nfunc undo()\n```\n\n## Example\nCheck the Example file!\n\n``` swift\nimport UIKit\nimport Poi\n\nclass ViewController: UIViewController, PoiViewDataSource, PoiViewDelegate {\n\n    @IBOutlet weak var poiView: PoiView!\n\n    var sampleCards = [UIView]()\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        var colors = [UIColor.red, UIColor.orange]\n        for i in (0..\u003c2) {\n            sampleCards.append(UIView(frame: CGRect(x: 0, y: 0, width: 240, height: 128)))\n            sampleCards[i].backgroundColor = colors[i]\n        }\n        poiView.dataSource = self\n        poiView.delegate = self\n    }\n\n    override func didReceiveMemoryWarning() {\n        super.didReceiveMemoryWarning()\n    }\n\n    // MARK: PoiViewDataSource\n    func numberOfCards(_ poi: PoiView) -\u003e Int {\n        return 2\n    }\n\n    func poi(_ poi: PoiView, viewForCardAt index: Int) -\u003e UIView {\n        return sampleCards[index]\n    }\n\n    func poi(_ poi: PoiView, viewForCardOverlayFor direction: SwipeDirection) -\u003e UIImageView? {\n        switch direction {\n        case .right:\n            return UIImageView(image: #imageLiteral(resourceName: \"good\"))\n        case .left:\n            return UIImageView(image: #imageLiteral(resourceName: \"bad\"))\n        }\n    }\n\n    // MARK: PoiViewDelegate\n    func poi(_ poi: PoiView, didSwipeCardAt: Int, in direction: SwipeDirection) {\n        switch direction {\n        case .left:\n            print(\"left\")\n        case .right:\n            print(\"right\")\n        }\n    }\n\n    func poi(_ poi: PoiView, runOutOfCardAt: Int, in direction: SwipeDirection) {\n        print(\"last\")\n    }\n\n    // MARK: IBAction\n    @IBAction func OKAction(_ sender: UIButton) {\n        poiView.swipeCurrentCard(to: .right)\n    }\n\n    @IBAction func undo(_ sender: UIButton) {\n        poiView.undo()\n    }\n}\n```\n## Contribution\nPlease create issues or submit pull requests for anything.\n\n## License\nPoi is released under the MIT license.\n\n© 2018 GitHub, Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHideakiTouhara%2FPoi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHideakiTouhara%2FPoi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHideakiTouhara%2FPoi/lists"}