Skip to content
KillianchiPublic

About

AI Keyboard iOS app

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BonMot - AI-Powered iOS Keyboard

BonMot is a production-ready iOS custom keyboard that uses AI to generate contextual responses based on screenshot context. Capture a screenshot, type an instruction, and let Claude AI generate the perfect response - all without leaving your current app.

Features

  • Full QWERTY Keyboard: Complete keyboard with letters, numbers, symbols, and all standard keys
  • Screenshot Capture: One-tap screenshot capture via Shortcuts integration
  • AI-Powered Responses: Uses Claude API to generate contextual responses based on screenshot OCR
  • Seamless Workflow: Tap πŸ“· β†’ Type instruction β†’ Tap ✨ β†’ Done
  • Privacy-First: All data stays on device except API calls to Claude
  • Auto-Cleanup: Screenshots automatically deleted after 24 hours
  • Native iOS Design: Matches system keyboard appearance and behavior

Requirements

  • iOS 17.0 or later
  • Xcode 15.0 or later
  • Claude API key from console.anthropic.com
  • iPhone (iPad support included but optimized for iPhone)

Project Structure

BonMot/
β”œβ”€β”€ App/                          # Main container app
β”‚   β”œβ”€β”€ BonMotApp.swift          # App entry point
β”‚   β”œβ”€β”€ Views/                    # SwiftUI views
β”‚   β”‚   β”œβ”€β”€ OnboardingView.swift # First-time setup flow
β”‚   β”‚   β”œβ”€β”€ SettingsView.swift   # API key and preferences
β”‚   β”‚   β”œβ”€β”€ SetupGuideView.swift # Step-by-step instructions
β”‚   β”‚   └── TestAreaView.swift   # Keyboard testing area
β”‚   β”œβ”€β”€ Services/                 # Core services
β”‚   β”‚   β”œβ”€β”€ PhotoService.swift   # Photo library management
β”‚   β”‚   β”œβ”€β”€ OCRService.swift     # Vision framework OCR
β”‚   β”‚   β”œβ”€β”€ ClaudeAPIService.swift # Claude API integration
β”‚   β”‚   └── SharedDataService.swift # App Group data
β”‚   β”œβ”€β”€ Utilities/
β”‚   β”‚   └── KeychainManager.swift # Secure API key storage
β”‚   β”œβ”€β”€ Intents/                  # App Intents for shortcuts
β”‚   β”‚   β”œβ”€β”€ TakeScreenshotIntent.swift
β”‚   β”‚   └── AppShortcuts.swift
β”‚   β”œβ”€β”€ Info.plist
β”‚   └── BonMot.entitlements
β”‚
β”œβ”€β”€ KeyboardExtension/            # Custom keyboard
β”‚   β”œβ”€β”€ KeyboardViewController.swift # UIKit controller
β”‚   β”œβ”€β”€ KeyboardView.swift       # SwiftUI keyboard view
β”‚   β”œβ”€β”€ KeyboardViewModel.swift  # Business logic
β”‚   β”œβ”€β”€ Keys/
β”‚   β”‚   β”œβ”€β”€ StandardKeyboard.swift # QWERTY layout
β”‚   β”‚   β”œβ”€β”€ ScreenshotButton.swift # πŸ“· button
β”‚   β”‚   └── AIButton.swift        # ✨ button
β”‚   β”œβ”€β”€ Info.plist
β”‚   └── KeyboardExtension.entitlements
β”‚
β”œβ”€β”€ Shared/                       # Shared code
β”‚   β”œβ”€β”€ SharedConstants.swift    # App Group IDs, API config
β”‚   └── SharedModels.swift       # Data models
β”‚
└── README.md

Installation & Setup

1. Open Project in Xcode

  1. Open BonMot.xcodeproj in Xcode
  2. Select your development team in both targets:
    • BonMot (main app)
    • BonMotKeyboard (keyboard extension)
  3. Update bundle identifiers if needed (must match your team)

2. Configure App Groups

IMPORTANT: App Groups allow the keyboard extension and main app to share data.

  1. In Xcode, select the BonMot target
  2. Go to Signing & Capabilities tab
  3. Click + Capability β†’ Add App Groups
  4. Enable the group: group.com.bonmot.shared
  5. Repeat for BonMotKeyboard target

3. Configure Keychain Sharing

  1. In both targets, add Keychain Sharing capability
  2. Add keychain group: com.bonmot.shared

4. Build and Run

  1. Connect your iPhone
  2. Select BonMot scheme
  3. Build and run (⌘R)
  4. The app will launch on your device

User Setup Guide

Step 1: Complete Onboarding

  1. Launch BonMot app
  2. Grant Photo Library Access when prompted
  3. Enter your Claude API Key from console.anthropic.com
  4. The app will validate your key

Step 2: Enable Keyboard

  1. Open iOS Settings
  2. Go to General β†’ Keyboard β†’ Keyboards
  3. Tap Add New Keyboard
  4. Select BonMot
  5. Tap BonMot again in the keyboard list
  6. Enable Allow Full Access (required for network and photo access)

Step 3: Create Screenshot Shortcut

IMPORTANT: iOS keyboards cannot directly take screenshots. We use Shortcuts to work around this.

Method 1: Create Shortcut Manually

  1. Open Shortcuts app
  2. Tap + to create new shortcut
  3. Add these actions in order:
    • Take Screenshot
    • Save to Photo Album β†’ Select "BonMot" album
    • Wait β†’ Set to 0.5 seconds
    • Return to previous app (under Scripting β†’ Apps)
  4. Name it "BonMot Screenshot"
  5. Tap Done

Method 2: Back Tap (Optional Alternative)

This allows capturing screenshots by tapping the back of your phone.

  1. Go to Settings β†’ Accessibility β†’ Touch β†’ Back Tap
  2. Choose Double Tap or Triple Tap
  3. Scroll to Shortcuts section
  4. Select "BonMot Screenshot"

Now you can double/triple tap the back of your phone to capture screenshots!

Step 4: Test the Keyboard

  1. Open any app with text input (Messages, Notes, etc.)
  2. Tap in a text field
  3. Long-press the 🌐 (globe) button to switch to BonMot keyboard
  4. Try typing some text
  5. Tap the πŸ“· button (or use Back Tap) to capture a screenshot
  6. You should see a brief checkmark confirmation

How to Use BonMot

Basic Workflow

  1. Open any app with text input (Messages, Mail, Notes, etc.)
  2. Switch to BonMot keyboard (long-press 🌐 globe button)
  3. Capture screenshot by tapping the πŸ“· button (or Back Tap)
    • You'll see a βœ“ checkmark briefly
  4. Type your instruction in the text field
    • Example: "reply politely saying no"
    • Example: "summarize this in 2 sentences"
    • Example: "write a professional response"
  5. Tap the ✨ AI button
    • Loading indicator appears
    • AI reads screenshot text via OCR
    • Generates response based on context + your instruction
    • Response replaces your instruction in the text field
  6. Review and send the generated text

Example Use Cases

Declining an invitation:

  • Screenshot the message
  • Type: "decline politely, say I'm busy"
  • Tap ✨

Replying to email:

  • Screenshot the email
  • Type: "write professional thanks, confirm meeting"
  • Tap ✨

Summarizing content:

  • Screenshot an article
  • Type: "summarize in 3 bullet points"
  • Tap ✨

Crafting responses:

  • Screenshot a conversation
  • Type: "friendly response agreeing to lunch"
  • Tap ✨

Keyboard Layout

[Q][W][E][R][T][Y][U][I][O][P]
 [A][S][D][F][G][H][J][K][L]
[⇧][Z][X][C][V][B][N][M][⌫]
[123][πŸ“·][ space ][✨][⏎]
  • ⇧ Shift: Tap for single capital, double-tap for caps lock
  • 123: Switch to numbers and symbols
  • πŸ“· Screenshot: Captures screen and saves to BonMot album
  • ✨ AI: Generates AI response from screenshot + instruction
  • ⌫ Delete: Delete character
  • ⏎ Return: New line / Submit
  • 🌐 Globe (long-press): Switch keyboards

Settings

Access settings in the BonMot app:

API Key

  • Update or remove Claude API key
  • Keys are stored securely in Keychain

Screenshot Management

  • Auto-delete after 24 hours: Automatically clean up old screenshots (default: ON)
  • Manual cleanup: Delete all screenshots immediately
  • View screenshot count

Keyboard

  • Quick link to iOS keyboard settings
  • Access setup guide

Troubleshooting

Keyboard Not Showing Up

Problem: BonMot doesn't appear in keyboard list

Solutions:

  • Make sure you added it in Settings β†’ Keyboards
  • Try restarting your device
  • Check that the app is installed properly
  • Remove and re-add the keyboard

AI Button Not Working

Problem: Tapping ✨ shows error or nothing happens

Solutions:

  • Verify Full Access is enabled (Settings β†’ Keyboards β†’ BonMot)
  • Check API key is set in BonMot app Settings
  • Ensure you have internet connection
  • Verify API key is valid at console.anthropic.com
  • Check that you captured a screenshot first (tap πŸ“·)

No Screenshot Found Error

Problem: "No screenshot found" error when tapping ✨

Solutions:

  • Tap the πŸ“· button first to capture a screenshot
  • Or use Back Tap if configured
  • Verify the BonMot photo album exists in Photos app
  • Check photo permissions are granted
  • Make sure the Shortcut is set up correctly

Screenshot Capture Not Working

Problem: Tapping πŸ“· doesn't capture screenshot

Solutions:

  • Verify you created the "BonMot Screenshot" shortcut
  • Check the shortcut has these actions:
    1. Take Screenshot
    2. Save to Photo Album β†’ "BonMot"
    3. Wait 0.5 seconds
    4. Return to previous app
  • Test the shortcut manually in Shortcuts app
  • Grant photo permissions to Shortcuts app if prompted
  • For Back Tap: verify it's configured in Accessibility settings

App Crashes or Freezes

Solutions:

  • Force quit and relaunch the app
  • Restart your device
  • Reinstall the app
  • Check for iOS updates
  • Clear all screenshots in Settings

OCR Not Reading Text

Problem: AI generates responses that don't match screenshot content

Solutions:

  • Ensure screenshot is clear and text is readable
  • Try with higher contrast screenshots
  • Check that screenshot was saved to BonMot album
  • Text in images works best with horizontal, clear text

Network Errors

Problem: "Network error" when using AI

Solutions:

  • Check internet connection (WiFi or cellular)
  • Verify Full Access is enabled (required for network)
  • Try again after a moment
  • Check Claude API status at status.anthropic.com

Privacy & Security

  • API Key: Stored securely in iOS Keychain with App Group sharing
  • Screenshots: Saved locally in "BonMot" photo album, auto-deleted after 24 hours
  • Network: Only API calls to Claude (requires Full Access)
  • Data: Screenshot text is sent to Claude API for generation, not stored
  • No tracking: No analytics or tracking of any kind

iOS Limitations

Why Full Access is Required

Apple requires "Allow Full Access" for keyboards to:

  • Make network requests (Claude API calls)
  • Access shared containers (photo album)
  • Open URLs (trigger screenshot shortcuts)

Without Full Access, the AI features will not work.

Screenshot Capture Limitations

iOS does not allow keyboard extensions to directly capture screenshots. Our workarounds:

  1. URL Scheme + Shortcut: Keyboard triggers a Shortcut that captures the screenshot
  2. Back Tap: Alternative method using Accessibility feature

Both methods briefly leave the current app but return immediately.

App Store Submission Notes

Before Submitting

  1. Update Bundle Identifiers: Change from com.bonmot.* to your own
  2. Add App Icons: Create icons in Assets.xcassets
    • Main app: 1024x1024 App Store icon
    • All required sizes for iOS
  3. Privacy Policy: Create and host a privacy policy
    • Update URLs in SettingsView.swift
  4. Test Thoroughly: Test on multiple iOS versions and devices
  5. Screenshots: Prepare App Store screenshots showing:
    • Keyboard in action
    • AI generation
    • Setup process

App Review Notes

Include this in your App Review notes:

BonMot is an AI-powered custom keyboard. To test:

1. Open the app and enter test API key: [provide a test key]
2. Grant photo permissions
3. Enable keyboard: Settings β†’ Keyboards β†’ Add BonMot β†’ Allow Full Access
4. Create screenshot shortcut (instructions in Setup Guide tab)
5. Open Messages app, switch to BonMot keyboard
6. Tap πŸ“· to capture screen, type "test instruction", tap ✨

Full Access is required for:
- Claude API network calls
- Photo album access for screenshots
- Triggering shortcuts via URL scheme

Screenshots are stored locally in "BonMot" album and auto-deleted after 24 hours.

Privacy Manifest

Add privacy descriptions for:

  • NSPhotoLibraryUsageDescription: "BonMot needs access to read screenshots from the BonMot album to provide context for AI-generated responses."
  • NSPhotoLibraryAddUsageDescription: "BonMot needs access to save screenshots to the BonMot album for use with the keyboard."

Development Notes

Xcode Project Setup

  • Targets: 2 targets (main app + keyboard extension)
  • Deployment: iOS 17.0+
  • Language: Swift 5.0
  • UI Framework: SwiftUI with UIKit integration for keyboard
  • No External Dependencies: Uses only system frameworks

Key Technologies

  • SwiftUI: All UI views
  • UIKit: Keyboard extension integration (UIInputViewController)
  • Vision Framework: OCR text recognition
  • Photos Framework: Photo library access
  • App Intents: Shortcuts integration
  • URLSession: Claude API networking
  • Keychain Services: Secure storage

Testing

Test on real device (keyboard extensions don't work in Simulator):

  1. Install app on device
  2. Enable keyboard in Settings
  3. Test in multiple apps (Messages, Notes, Mail)
  4. Test screenshot capture
  5. Test AI generation with various instructions
  6. Test error handling (no API key, no screenshot, network errors)

Known Limitations

  • Keyboard extensions cannot directly capture screenshots (OS limitation)
  • Requires Full Access for network and shared data (OS requirement)
  • OCR accuracy depends on screenshot text clarity
  • Claude API rate limits apply
  • No offline mode (requires internet for AI)

API Usage & Costs

BonMot uses the Claude API (claude-sonnet-4-20250514 model):

  • Input: ~500-2000 tokens (OCR text + instruction)
  • Output: ~100-500 tokens (generated response)
  • Cost: ~$0.003-0.015 per request (varies by length)

Monitor your usage at console.anthropic.com.

Support

For issues, questions, or feature requests:

  • GitHub Issues: [Your GitHub repo]
  • Email: [Your support email]

License

[Your chosen license - MIT, Apache, etc.]

Credits

Built with:

  • Claude API by Anthropic
  • SwiftUI by Apple
  • Vision Framework by Apple

Version: 1.0.0 Minimum iOS: 17.0 Last Updated: 2025

About

AI Keyboard iOS app

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages