{"id":19761539,"url":"https://github.com/samuelbeek/recordbutton","last_synced_at":"2025-04-30T14:30:30.353Z","repository":{"id":56398590,"uuid":"43817653","full_name":"samuelbeek/RecordButton","owner":"samuelbeek","description":"A record button in Swift","archived":false,"fork":false,"pushed_at":"2020-11-10T09:07:58.000Z","size":73,"stargazers_count":129,"open_issues_count":5,"forks_count":34,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-19T22:02:29.811Z","etag":null,"topics":["animation","button","camera","recording","swift","ui"],"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/samuelbeek.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-10-07T13:29:30.000Z","updated_at":"2024-05-22T08:38:42.000Z","dependencies_parsed_at":"2022-08-15T18:00:42.021Z","dependency_job_id":null,"html_url":"https://github.com/samuelbeek/RecordButton","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelbeek%2FRecordButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelbeek%2FRecordButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelbeek%2FRecordButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelbeek%2FRecordButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samuelbeek","download_url":"https://codeload.github.com/samuelbeek/RecordButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251721381,"owners_count":21632827,"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":["animation","button","camera","recording","swift","ui"],"created_at":"2024-11-12T03:41:34.742Z","updated_at":"2025-04-30T14:30:29.964Z","avatar_url":"https://github.com/samuelbeek.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RecordButton\n\n[![CI Status](http://img.shields.io/travis/samuelbeek/RecordButton.svg?style=flat)](https://travis-ci.org/samuelbeek/RecordButton)\n[![Version](https://img.shields.io/cocoapods/v/RecordButton.svg?style=flat)](http://cocoapods.org/pods/RecordButton)\n[![License](https://img.shields.io/cocoapods/l/RecordButton.svg?style=flat)](http://cocoapods.org/pods/RecordButton)\n[![Platform](https://img.shields.io/cocoapods/p/RecordButton.svg?style=flat)](http://cocoapods.org/pods/RecordButton)\n\n\nA Record Button in Swift. Inspired by [SDRecordButton](https://github.com/sebyddd/SDRecordButton)\nIt shows you the recording process when recording. It's great for a video recorder app with a fixed/maximum length like snapchat, vine, instragram.\n\n![Screenshot](http://imgur.com/S69GerW.gif)\n\n## Requirements\n\niOS 8 and higher\n\n## Example Project\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n\n## Installation\n\nRecordButton is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\n\npod \"RecordButton\"\n\n```\n\nAdd this line add the top of the file you want to use this module in `import RecordButton`\n\n\n## Usage \n\n### Add a simple RecordButton\n\nAdd this to `viewDidLoad`\n\n```swift \n\nlet recordButton = RecordButton(frame: CGRect(x: 0,y: 0,width: 70,height: 70))\nview.addSubview(recordButton) \n\n``` \n\n### Update progress \n*it's the easiest to just check out the example project for this.*\n\nTo update progress the RecordButton must be an instance of the class. You should also add a `progressTimer` and a `progress` variable, like this: \n\n```swift \n\nclass ViewController: UIViewController {\n\n\tvar recordButton : RecordButton!\n\tvar progressTimer : Timer!\n\tvar progress : CGFloat = 0\n\t\n\t// rest of viewController \n\t\n```\n\nThe `recordButton` needs a target for start and stopping the progress timer. Add this code after initialization of the `recordButton` (usualy in `viewDidLoad()`)\n\n```swift\n\nrecordButton.addTarget(self, action: #selector(self.record), for: .touchDown)\nrecordButton.addTarget(self, action: #selector(self.stop), for: UIControl.Event.touchUpInside)\n\n```\n\nFinally add these functions to your ViewController \n\n```swift\n\n    @objc func record() {\n        self.progressTimer = Timer.scheduledTimer(timeInterval: 0.05, target: self, selector: #selector(ViewController.updateProgress), userInfo: nil, repeats: true)\n    }\n    \n    @objc func updateProgress() {\n        \n        let maxDuration = CGFloat(5) // Max duration of the recordButton\n        \n        progress = progress + (CGFloat(0.05) / maxDuration)\n        recordButton.setProgress(progress)\n        \n        if progress \u003e= 1 {\n            progressTimer.invalidate()\n        }\n        \n    }\n    \n    @objc func stop() {\n        self.progressTimer.invalidate()\n    }\n    \n```\n## Support/Issues \nIf you have any questions, please don't hesitate to create an issue. \n\n## To Do \n* Add Carthage Support\n* Add a delegation pattern\n\n## Author\n\n[samuelbeek](http://twitter.com/samuelbeek) - iOS Developer, Consultant and Occasional Designer\n\n## Acknowledgements\nThis button is heavely inspired by [SDRecordButton](https://github.com/sebyddd/SDRecordButton), which is made by [Sebyddd](https://github.com/sebyddd)\n\n## License\n\nRecordButton is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelbeek%2Frecordbutton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamuelbeek%2Frecordbutton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelbeek%2Frecordbutton/lists"}