{"id":2792,"url":"https://github.com/cocoatoucher/AIFlatSwitch","last_synced_at":"2025-08-03T12:31:10.061Z","repository":{"id":29827869,"uuid":"33372446","full_name":"cocoatoucher/AIFlatSwitch","owner":"cocoatoucher","description":"Nicely animated flat design switch alternative to UISwitch","archived":false,"fork":false,"pushed_at":"2022-06-06T00:00:45.000Z","size":139,"stargazers_count":983,"open_issues_count":0,"forks_count":65,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-04-24T18:57:37.994Z","etag":null,"topics":["animated","animation","button","checkbox","checkmark","custom","design","flat","material","smooth","swift","switch","uiswitch"],"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/cocoatoucher.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":"2015-04-03T16:41:54.000Z","updated_at":"2024-04-24T05:31:27.000Z","dependencies_parsed_at":"2022-08-07T14:30:50.781Z","dependency_job_id":null,"html_url":"https://github.com/cocoatoucher/AIFlatSwitch","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocoatoucher%2FAIFlatSwitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocoatoucher%2FAIFlatSwitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocoatoucher%2FAIFlatSwitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocoatoucher%2FAIFlatSwitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cocoatoucher","download_url":"https://codeload.github.com/cocoatoucher/AIFlatSwitch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228543113,"owners_count":17934427,"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":["animated","animation","button","checkbox","checkmark","custom","design","flat","material","smooth","swift","switch","uiswitch"],"created_at":"2024-01-05T20:16:22.979Z","updated_at":"2024-12-07T00:30:54.908Z","avatar_url":"https://github.com/cocoatoucher.png","language":"Swift","readme":"# AIFlatSwitch\n\nA smooth, nice looking and IBDesignable flat design switch for iOS. Can be used instead of UISwitch.\n\nInspired by Creativedash's Dribbble post [here](http://dribbble.com/shots/1631598-On-Off)\n\n\u003cp align=\"center\"\u003e\n\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"http://dribbble.com/shots/1631598-On-Off\"\u003e\n\u003cimg src=\"https://s3.amazonaws.com/f.cl.ly/items/1p0w3B0E3m2I2k3e0z1Q/onoff.gif\" width=\"200\" max-width=\"80%\" alt=\"Flat switch animation\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/Swift-5.0-orange.svg\"/\u003e\n\u003ca href=\"https://cocoapods.org/pods/AIFlatSwitch\"\u003e\n\u003cimg src=\"https://img.shields.io/cocoapods/v/AIFlatSwitch.svg\" alt=\"cocoapods\"/\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\"/\u003e\n\u003c/p\u003e\n\n## Requirements\n- iOS 8.0+, tvOS 12.0+\n- Xcode 11.0+\n- Swift 5\n\n## Usage\n\n### Creating the flat switch\n\n- Either programmatically\n\n```swift\nvar flatSwitch = AIFlatSwitch(frame: CGRectMake(0, 0, 50, 50))\n```\n\n- Or in Interface Builder\n\n### Methods\n\n\u003e To change its selected state:\n\n```swift\nflatSwitch.isSelected = true\n```\n- [x] IBInspectable\n\n\u003e or:\n\n```swift\nflatSwitch.setSelected(true, animated: true)\n```\n\n\u003e To listen to its state changes:\n\n```swift\n@IBAction func handleSwitchValueChange(sender: AnyObject) {\n\t\tif let flatSwitch = sender as? AIFlatSwitch {\n\t\t\tprint(flatSwitch.isSelected)\n\t\t}\n\t}\n```\n\n\u003e Animation observer callbacks:\n\n```swift\nflatSwitch.selectionAnimationDidStart = { isSelected in\n    print(\"New state: \\(isSelected)\")\n}\n\nflatSwitch.selectionAnimationDidStop = { isSelected in\n    print(\"State when animation stopped: \\(isSelected)\")\n}\n```\n\n\u003e Styling the switch:\n\n```swift\nflatSwitch.lineWidth = 2.0\nflatSwitch.strokeColor = UIColor.blue\nflatSwitch.trailStrokeColor = UIColor.red\nflatSwitch.backgroundLayerColor = UIColor.red\nflatSwitch.animatesOnTouch = false\n```\n- [x] IBInspectable\n\n## Contribution guidelines\n\n- Make your changes in your branch\n- Bump the pod version in AIFlatSwitch.podspec file (e.g. 1.0.1 to 1.0.2)\n- Make sure the Example project compiles and works fine in the Simulator\n- Find references to your source code changes in README.md and update them (e.g. method names, changed features)\n- Create a pull request\n\n## License\n\nAIFlatSwitch is released under the MIT license. See LICENSE for details.\n\nanimated check button, checkmark\n","funding_links":[],"categories":["UI","Content","Libs"],"sub_categories":["Switch","Layout","Other free courses","UI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcocoatoucher%2FAIFlatSwitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcocoatoucher%2FAIFlatSwitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcocoatoucher%2FAIFlatSwitch/lists"}