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.
ReCaptcha is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ReCaptcha"
Simply add ReCaptchaKey
and ReCaptchaDomain
to your Info.plist and run:
let recaptcha = try? ReCaptcha()
override func viewDidLoad() {
super.viewDidLoad()
recaptcha?.presenterView = view
recaptcha?.configureWebView { [weak self] webview in
webview.frame = self?.view.bounds ?? CGRect.zero
}
}
func validate() {
recaptcha?.validate { [weak self] result in
print(try? result.dematerialize())
}
}
Flávio Caetano, [email protected]
ReCaptcha is available under the MIT license. See the LICENSE file for more info.