A Swift project to showcase implementation of Google ReCaptcha in iOS Application.
- A light weight basic wrapper to handle comunications with Google ReCaptcha decides and show caoptcha challenge on need and return callback to calling class.
- A view controller containing a form and captchaverify button which is using this wrapper just by minimul line of code.
In your project, wherever you want to show Google ReCaptcha and verify it instead of some local captcha logic. Please follow instructions mentioned below :
- Register on https://www.google.com/recaptcha/about/ with domain and save API key and secret generated.
- Add wrapper CaptchaWrapper. and CaptchaWrapper.m in your project.
- If your project is in Swift, then create Bridging Header and import CaptchaWrapper.h in that file. For more detail . If project is in Objective-c tyhen skip this step.
- Import CaptchaWrapper.h class in your class, where you want users to validate captcha. Or import in Bridging Header(in case of Swift project).
- In your own class initialize wrapper object like : let captchaWrapper = CaptchaWrapper.init(reCaptchaWithApiKey: captchaSiteKey, baseURL: baseUrl)
Here pass Captcha public key in captchaSiteKey and url in baseURL with your domain registered on google cosole. 6. On clicking of captcha checkbox or button, call validateReCaptcha method of the wrapper. And you will get completion handler after call.