Latest 0.0.4
Homepage https://github.com/svtek/RecordButton
License MIT
Platforms ios 9.0
Dependencies PRTween
Authors

RecordButton

iOS Button mimicking record button in Apple’s VoiceRecorder app. It also displays the recording process when recording. It’s great for a video recorder app with a fixed/maximum length like snapchat, vine, instragram.

It has start and stop sounds included.

Example

Installation

RecordButton is available through CocoaPods. To install
it, simply add the following line to your Podfile:


pod "RecordButtonSwift"

Add this line add the top of the file you want to use this module in import RecordButton

Update progress

it’s the easiest to just check out the example project for this.

To update progress the RecordButton must be an instance of the class. You should also add a progressTimer and a progress variable, like this:


class ViewController: UIViewController {

    var recordButton : RecordButton!
    var progressTimer : NSTimer!
    var progress : CGFloat! = 0

    // rest of viewController 

The recordButton needs a target for start and stopping the progress timer. Add this code after initialization of the recordButton (usualy in viewDidLoad())


recordButton.addTarget(self, action: "record", forControlEvents: .TouchDown)
recordButton.addTarget(self, action: "stop", forControlEvents: UIControlEvents.TouchUpInside)

Finally add these functions to your ViewController


    func record() {
        self.progressTimer = NSTimer.scheduledTimerWithTimeInterval(0.05, target: self, selector: "updateProgress", userInfo: nil, repeats: true)
    }

    func updateProgress() {

        let maxDuration = CGFloat(5) // max duration of the recordButton

        progress = progress + (CGFloat(0.05) / maxDuration)
        recordButton.setProgress(progress)

        if progress >= 1 {
            progressTimer.invalidate()
        }

    }

    func stop() {
        self.progressTimer.invalidate()
    }

Authors

RecordButtonSwift Omer Karisman

Lead UI/UX @ MojiLaLa
Twitter Dribble Github

RecordButtonSwift Sahin Boydas

Co-Founder @ MojiLaLa
LinkedIn

Inspired from

samuelbeek, http://samuelbeek.com
alldritt, http://markalldritt.com

Latest podspec

{
    "name": "RecordButtonSwift",
    "version": "0.0.4",
    "summary": "Animated and Progressive Record Button",
    "description": "Record button with start and stop animation. Also with progress bar.",
    "homepage": "https://github.com/svtek/RecordButton",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "okaris": "[email protected]"
    },
    "social_media_url": "http://twitter.com/okarisman",
    "source": {
        "git": "https://github.com/svtek/RecordButton.git",
        "tag": "0.0.4"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "RecordButton/Classes/**/*",
    "exclude_files": "Classes/Exclude",
    "resources": "RecordButton/Assets/**/*",
    "dependencies": {
        "PRTween": [
            "~> 0.0.1"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This