{"id":15067001,"url":"https://github.com/pulkit-vaid/pvswitch","last_synced_at":"2025-07-18T13:38:23.093Z","repository":{"id":62450301,"uuid":"120729052","full_name":"pulkit-vaid/PVSwitch","owner":"pulkit-vaid","description":"A Customizable iOS Switch with Inspectable Properties. ","archived":false,"fork":false,"pushed_at":"2018-02-13T07:31:35.000Z","size":664,"stargazers_count":13,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-15T05:44:58.049Z","etag":null,"topics":["android-switch","custom","github","ios","ios-switch","ios10","ios11","material","pulkit","pulkit-vaid","swift","swift4","switch","uiswitch","vaid"],"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/pulkit-vaid.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-08T07:52:25.000Z","updated_at":"2023-06-29T15:00:04.000Z","dependencies_parsed_at":"2022-11-01T23:31:40.496Z","dependency_job_id":null,"html_url":"https://github.com/pulkit-vaid/PVSwitch","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/pulkit-vaid%2FPVSwitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulkit-vaid%2FPVSwitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulkit-vaid%2FPVSwitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulkit-vaid%2FPVSwitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pulkit-vaid","download_url":"https://codeload.github.com/pulkit-vaid/PVSwitch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248229387,"owners_count":21068884,"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":["android-switch","custom","github","ios","ios-switch","ios10","ios11","material","pulkit","pulkit-vaid","swift","swift4","switch","uiswitch","vaid"],"created_at":"2024-09-25T01:15:05.047Z","updated_at":"2025-04-10T13:54:26.935Z","avatar_url":"https://github.com/pulkit-vaid.png","language":"Swift","readme":"# PVSwitch\n\n[![CI Status](http://img.shields.io/travis/pulkit-vaid/PVSwitch.svg?style=flat)](https://travis-ci.org/pulkit-vaid/PVSwitch)\n[![Version](https://img.shields.io/cocoapods/v/PVSwitch.svg?style=flat)](http://cocoapods.org/pods/PVSwitch)\n[![License](https://img.shields.io/cocoapods/l/PVSwitch.svg?style=flat)](http://cocoapods.org/pods/PVSwitch)\n[![Platform](https://img.shields.io/cocoapods/p/PVSwitch.svg?style=flat)](http://cocoapods.org/pods/PVSwitch)\n\n## Overview\n\u003cimg src=\"Screens/MockUp.png\" width=\"400\" align=\"right\" /\u003e\n\n`PVSwitch` is a Customizable Switch with the design inspired by Android's Switch. \n\nThis library has customizable properties that can be tweaked right from the `Storyboard` i.e. `Inspectable Properties`, making you play around with the Switch UI at compile time. \n\n\u003cimg src=\"Screens/Rainbow.gif\" width=\"100\" /\u003e      \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"Screens/Bounce.gif\" width=\"200\" /\u003e\n\u003cbr/\u003e\n\u003cbr/\u003e \n## Installation\n* **CocoaPods** \u003cbr/\u003e\n`PVSwitch` is available on CocoaPods.\nYou can use this library by adding the following command onto your Podfile:\n```ruby\npod 'PVSwitch'\n```\n\n* **Manual** \u003cbr/\u003e\nJust Drag+Drop the Source file into yor project. `PVSwitch/Source/PVSwitch.swift`\n\n\n## Usage\n\u003cimg src=\"Screens/Inspectable.png\" width=\"175\" align=\"right\" /\u003e \u003cbr/\u003e\n\n* **Storybord**  \u003cbr/\u003e\nThe simplest way to use `PVSwitch` is from the `Storyboard`. Just drag a view into the Storyboard and in the `Identity Inspector (⌘ ⌥ 3)` and set the `Class` field in `Custom Class` section to **PVSwitch**. \nThe storyboard refreshes itself to bring up the inspectable properties to fiddle around with. \n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n* **Code** \u003cbr/\u003e\nAdding `PVSwitch` through the code is as easy as using it from the Storyboard. \u003cbr/\u003e\nConsidering our `ViewController` has a `Container View` and `PVSwitch` has to be added as a subview.\n\n```swift \nclass ViewController: UIViewController {\n\tlet switchByCode = PVSwitch()\n\t@IBOutlet var containerView: UIView!\n\n\toverride func viewDidLoad() {\n\t\tsuper.viewDidLoad()\n\t\tself.setupSwitch()\n\t}\n}\n```\nSetting up the Switch\n```swift\nprivate func setupSwitch() {\n\t//Customize the Properties if the Switch is added by Code\n\tswitchByCode.isOn = true\n\n\tswitchByCode.isBounceEnabled = false\n\n\tswitchByCode.thumbOnTintColor = .white\n\tswitchByCode.trackOnTintColor = .green\n\n\tswitchByCode.thumbOffTintColor = .darkGray\n\tswitchByCode.trackOffTintColor = .lightGray\n\n        //To handle the events\n\tswitchByCode.addTarget(self, action: #selector(ViewController.codeSwitchAction(sender:)), for: .valueChanged)\n\tcontainerView.addSubview(switchByCode)\n}\n```\nOne last thing to do for this to work. In `viewDidLayoutSubviews` make sure to update the frames of the `PVSwitch` to be the container's bounds. \n```swift\noverride func viewDidLayoutSubviews() {\n\tsuper.viewDidLayoutSubviews()\n\n\t//Make sure to set the frame of the switch if the Switch is added by Code\n\tswitchByCode.frame = containerView.bounds\n}\n```\n\n## Change History\n1.0.0 Initial Release\n\n## Requirements\niOS 11.0 or later\n\n## Author\nPulkit Vaid\n\n## License\nPVSwitch is available under the MIT license.\n\n### Credits\nThis Switch is inspired by [JTMaterialSwitch](https://github.com/JunichiT/JTMaterialSwitch/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpulkit-vaid%2Fpvswitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpulkit-vaid%2Fpvswitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpulkit-vaid%2Fpvswitch/lists"}