Latest 1.4.2
Homepage https://github.com/fjcaetano/ReCaptcha
License MIT
Platforms ios 8.0
Authors

Build Status
Version
License
Platform
codecov
Carthage compatible


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 and Carthage.
To install it, simply add the following line to your dependencies file:

Cocoapods

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

Carthage

github "fjcaetano/ReCaptcha"

Carthage will create two different frameworks named ReCaptcha and ReCaptcha_RxSwift, the latter containing the RxSwift
extension for the ReCaptcha framework.

Usage

Simply add ReCaptchaKey and ReCaptchaDomain (with a protocol) 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: ReCaptchaResult) in
        print(try? result.dematerialize())
    }
}

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

recaptcha.rx.validate(on: view)
    .subscribe(onNext: { (token: String) in
        // Do something
    })

Alternte endpoint

If your app has firewall limitations that may be blocking Google’s API, the JS endpoint may be changed on initialization.
It’ll then point to https://www.recaptcha.net/recaptcha/api.js:

public enum Endpoint {
    case default, alternate
}

let recaptcha = try? ReCaptcha(endpoint: .alternate) // Defaults to `default` when unset

Help Wanted

Do you love ReCaptcha and work actively on apps that use it? We’d love if you could help us keep improving it!
Feel free to message us or to start contributing right away!

Full Documentation

License

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

Latest podspec

{
    "name": "ReCaptcha",
    "version": "1.4.2",
    "summary": "ReCaptcha for iOS",
    "swift_version": "4.2",
    "description": "Add Google's [Invisible ReCaptcha](https://developers.google.com/recaptcha/docs/invisible) to your project. This librarynautomatically handles ReCaptcha's events and retrieves the validation token or notifies you to present the challenge ifninvisibility is not possible.",
    "homepage": "https://github.com/fjcaetano/ReCaptcha",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Flu00e1vio Caetano": "[email protected]"
    },
    "source": {
        "git": "https://github.com/fjcaetano/ReCaptcha.git",
        "tag": "1.4.2"
    },
    "social_media_url": "https://twitter.com/flavio_caetano",
    "documentation_url": "http://fjcaetano.github.io/ReCaptcha",
    "platforms": {
        "ios": "8.0"
    },
    "default_subspecs": "Core",
    "subspecs": [
        {
            "name": "Core",
            "source_files": "ReCaptcha/Classes/*",
            "frameworks": "WebKit",
            "resource_bundles": {
                "ReCaptcha": [
                    "ReCaptcha/Assets/**/*"
                ]
            }
        },
        {
            "name": "RxSwift",
            "source_files": "ReCaptcha/Classes/Rx/**/*",
            "dependencies": {
                "ReCaptcha/Core": [],
                "RxSwift": [
                    "~> 4.3"
                ]
            }
        }
    ]
}

Pin It on Pinterest

Share This