{"id":20519470,"url":"https://github.com/Frog-Frog/OTSortButton","last_synced_at":"2025-05-09T09:31:23.337Z","repository":{"id":62449426,"uuid":"103526413","full_name":"Frog-Frog/OTSortButton","owner":"Frog-Frog","description":" OTSortButton is a UIButton library useful for sorting.","archived":false,"fork":false,"pushed_at":"2017-09-16T14:35:09.000Z","size":83,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-08T11:02:50.344Z","etag":null,"topics":["ios","iphone","swift","swift3","uibutton"],"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/Frog-Frog.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":"2017-09-14T11:53:46.000Z","updated_at":"2023-07-18T12:11:27.000Z","dependencies_parsed_at":"2022-11-01T23:17:08.820Z","dependency_job_id":null,"html_url":"https://github.com/Frog-Frog/OTSortButton","commit_stats":null,"previous_names":["pkpk-carnage/otsortbutton"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frog-Frog%2FOTSortButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frog-Frog%2FOTSortButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frog-Frog%2FOTSortButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frog-Frog%2FOTSortButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Frog-Frog","download_url":"https://codeload.github.com/Frog-Frog/OTSortButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253226467,"owners_count":21874333,"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":["ios","iphone","swift","swift3","uibutton"],"created_at":"2024-11-15T22:14:07.100Z","updated_at":"2025-05-09T09:31:22.924Z","avatar_url":"https://github.com/Frog-Frog.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OTSortButton\n\n## Description\n OTSortButton is a UIButton library useful for sorting.\n\n## Features\n・Change appearance for each parts and sort types.\n\n## Demo\n![otsortbuttondemo](https://user-images.githubusercontent.com/20692907/30483166-d765c672-9a60-11e7-8753-87bdcf4cdddc.gif)\n \n## Usage\n1.Set OTSortButton to Custom Class and Module of your UIButton. \n\n![2017-09-15 21 10 54](https://user-images.githubusercontent.com/20692907/30481581-6a2e9166-9a5a-11e7-939d-ccec96b11136.png)\n\n\nThe appearance can be set with IBInspectable.\n\n![2017-09-15 21 27 45](https://user-images.githubusercontent.com/20692907/30482111-c25eb6fc-9a5c-11e7-9d21-50924081d4a6.png)\n\n2.Import and connect IBOutlet\n\n```swift\nimport OTSortButton\n\n@IBOutlet var sortButtonCollection: [OTSortButton]!\n```\n\n3.If you want to set the key on the button, please set it as the sort key\n\n```swift\n\n@IBOutlet weak var yourSortButton: OTSortButton!\n\nyourSortButton.sortKey = \"yourKey\"\n\n```\n\n4.Connect IBAction\n\n```swift\n@IBAction func tappedSortButton(_ sender: OTSortButton) {\n\tfor sortButton in sortButtonCollection {\n\t\tif sortButton == sender {\n\t        \tlet key = sortButton.sortKey\n\t\t\tswitch sortButton.sortType {\n\t\t\tcase .none:\n\t\t\t\n\t\t    \t\tsortButton.sortType = .ascend\n\t\t    \t\t// Sort ascend here.\n       \t    \t\t\t//e.g. sortedArray = yourArray.sorted(by: { $0[key]! \u003c $1[key]! })\n\t\t\t\t\n    \t\t\tcase .ascend:\n\t\t\t\n       \t\t\t\tsortButton.sortType = .descend\n\t\t\t\t// Sort descend here.\n     \t   \t\t\t//e.g. sortedArray = yourArray.sorted(by: { $0[key]! \u003e $1[key]! })\n\t\t\t\t\n        \t\tcase .descend:\n\t\t\t\n\t\t\t\tsortButton.sortType = .none\n           \t\t\t// Undo here.\n           \t\t\t//e.g. sortedArray = yourArray     \n\t\t\t}\n   \t\t} else {\n       \t\t\tsortButton.sortType = .none\n     \t\t}\n\t}\n\tyourView.reloadData()\n}\n\n\n```\n\n## Install\n\n### CocoaPods  \nAdd this to your Podfile.\n\n```PodFile\npod 'OTSortButton'\n```\n\n### Carthage  \nAdd this to your Cartfile.\n\n```Cartfile\ngithub \"PKPK-Carnage/OTSortButton\"\n```\n\n## Help\n\nIf you want to support this framework, you can do these things.\n\n* Please let us know if you have any requests for me.\n\n\tI will do my best to live up to your expectations.\n\n* You can make contribute code, issues and pull requests.\n\t\n\tI promise to confirm them.\n\n## Licence\n\n[MIT](https://github.com/PKPK-Carnage/OTSortButton/blob/master/LICENSE)\n\n## Author\n\n[PKPK-Carnage🦎](https://github.com/PKPK-Carnage)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrog-Frog%2FOTSortButton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFrog-Frog%2FOTSortButton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrog-Frog%2FOTSortButton/lists"}