Project structure
-
./StartViewController.swiftHost controller from which captcha is invoked -
./Coredirectory:-
SheetPresentationController.swiftandSheetTransition.swiftare used if captcha is going to be invoked as a sheet. To enable a sheet in a test project, use theisSheetCaptchaModeproperty of theStartViewControllerclass. -
ProtectedController.swift: Screen displayed after captcha is successfully passed. -
./Core/Settings UI: Settings screen used for testing and invoked after the app starts. This screen is used to invokeStartViewController.Captcha open modedetermines whether to bring captcha to the screen right away or only after an unsuccessful verification.Captcha resultdetermines the verification result; if Always success = true, the result will always be considered successful.
-
-
./Core/Validationdirectory: Classes for validating the data supplied by captcha following a request to backend. -
./Core/Webdirectory contains classes for the following entities:CaptchaWebContainer.swiftis a container class for captcha; it includes a link to webView and shares it when switching between controllers.MessageHandler.swiftis a class for listening to messages from webView.WebContentController.swiftis a controller for displaying webView with a captcha.
This application is an example of the CAPTCHA configuration described here: Yandex SmartCaptcha in iOS apps.