Skip to content

Commit

Permalink
add quickstart docs for Example (#163)
Browse files Browse the repository at this point in the history
* add quickstart docs for Example

* Update README.md

* Update README.md

* Apply suggestions from code review
  • Loading branch information
e271828- authored Sep 16, 2024
1 parent 0e1deb8 commit 4152d62
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Example/README.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 4152d62

Please sign in to comment.