From 4152d62c0ea40a9e1925fe78afd4a4085236361a Mon Sep 17 00:00:00 2001 From: e271828- Date: Mon, 16 Sep 2024 15:00:56 -0400 Subject: [PATCH] add quickstart docs for Example (#163) * add quickstart docs for Example * Update README.md * Update README.md * Apply suggestions from code review --- Example/README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Example/README.md diff --git a/Example/README.md b/Example/README.md new file mode 100644 index 0000000..52e0b78 --- /dev/null +++ b/Example/README.md @@ -0,0 +1,49 @@ +# HCaptcha Example App + +This app is designed to let you quickly experiment with HCaptcha SDK options. + +You can also simply copy the example code in the ViewController to get up and running quickly in your own app. + + +## Quickstart: Building the Example + +If you don't already have a working CocoaPods environment, we recommend homebrew: + +`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"` + +Then install CocoaPods: + +`brew install cocoapods` + +Finally, install the pods needed for the Example app: + +`pod install` + + +You should now be able to build and run the example in Xcode. + + +## Example Changes + +### Switching to a Visible Checkbox + +You can try switching the 'size' parameter or any other by editing Example/HCaptcha/ViewController.swift + +For example: + +``` +@@ -175,7 +176,7 @@ class ViewController: UIViewController { + } + + // swiftlint:disable:next force_try +- hcaptcha = try! HCaptcha(locale: locale) ++ hcaptcha = try! HCaptcha(locale: locale, size: .normal) +``` + +Tapping "Validate" will now show a visible checkbox, which can be tapped to continue the interaction. + +### Changing the Example Sitekey + +This example app sets the sitekey in Example/HCaptcha/Info.plist via the `HCaptchaKey` field. + +You can replace it with your own sitekey to try a different sitekey configuration, e.g. Passive mode.