Go to file
Flávio Caetano cf39fda4d3 Fixing Travis-CI builds 2017-09-29 13:39:55 -03:00
Example Adding tests for #6 2017-09-27 16:53:31 -03:00
ReCaptcha Adding tests for #6 2017-09-27 16:53:31 -03:00
.gitignore Documentation 2017-04-11 18:27:10 -03:00
.swift-version Fixing Travis-CI builds 2017-09-29 13:39:55 -03:00
.travis.yml Fixing Travis-CI builds 2017-09-29 13:39:55 -03:00
CHANGELOG.md CHANGELOG 2017-04-13 17:21:45 -03:00
LICENSE Initial code 2017-04-11 15:00:44 -03:00
README.md Fix: Documenting that this only works with Invisible ReCaptcha keys 2017-08-04 15:03:41 -03:00
ReCaptcha.podspec Updating README 2017-04-18 15:35:55 -03:00
_Pods.xcodeproj Initial code 2017-04-11 15:00:44 -03:00
codecov.yml Fixing docs & codecov.yml 2017-04-17 10:43:14 -03:00
example.gif Adding gif to README 2017-04-18 15:54:02 -03:00
example2.gif Adding new example gif 2017-07-14 11:48:52 -04:00

README.md

ReCaptcha

Build Status Version License Platform codecov


Add Google's Invisible ReCaptcha to your project. This library automatically handles ReCaptcha's events and retrieves the validation token or notifies you to present the challenge if invisibility is not possible.

Example Gif 2 Example Gif

Warning ⚠️

Beware that this library only works for Invisible ReCaptcha keys! Make sure to check the Invisible reCAPTCHA option when creating your API Key

Installation

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

pod "ReCaptcha"
# or
pod "ReCaptcha/RxSwift"

Usage

Simply add ReCaptchaKey and ReCaptchaDomain to your Info.plist and run:

let recaptcha = try? ReCaptcha()

override func viewDidLoad() {
    super.viewDidLoad()

    recaptcha?.configureWebView { [weak self] webview in
        webview.frame = self?.view.bounds ?? CGRect.zero
    }
}


func validate() {
    recaptcha?.validate(on: view) { [weak self] result in
        print(try? result.dematerialize())
    }
}

You can also install the reactive subpod and use it with RxSwift:

recaptcha.rx.validate(on: view)
    .map { try $0.dematerialize() }
    .subscribe(onNext: { (token: String) in
        // Do something
    })

License

ReCaptcha is available under the MIT license. See the LICENSE file for more info.