Overview
Paw & Care leverages Capacitor to bridge web technologies with native iOS capabilities. This provides a seamless mobile experience with access to device features like camera, haptics, status bar, keyboard, and more. Capacitor Version: 8.xPlatform: iOS 15.0+
Configuration:
capacitor.config.ts
Installed Plugins
The app includes the following Capacitor plugins:Core
@capacitor/core (8.1.0) - Base Capacitor runtime
iOS Platform
@capacitor/ios (8.1.0) - iOS platform support
Haptics
@capacitor/haptics (8.0.0) - Tactile feedback
Keyboard
@capacitor/keyboard (8.0.0) - Keyboard controls
Status Bar
@capacitor/status-bar (8.0.1) - Status bar styling
Splash Screen
@capacitor/splash-screen (8.0.1) - Launch screen
package.json:18-24 for full dependency list.
Capacitor Configuration
The app’s native behavior is configured incapacitor.config.ts:
capacitor.config.ts:1-30
Capacitor Initialization
Native plugins are initialized when the app launches:src/lib/capacitor.ts:10-39
Call this in your main app:
Platform Detection
Check if Running Natively
src/lib/capacitor.ts:70-72:
Get Current Platform
src/lib/capacitor.ts:77-79.
Haptic Feedback
Provide tactile feedback for user interactions:Light Tap
For navigation, tab switches, and subtle interactions:src/App.tsx:104-108.
Medium Impact
For important actions, confirmations, and alerts:src/lib/capacitor.ts:44-65
Best Practices
Use Sparingly
Too much haptic feedback becomes annoying. Reserve for important interactions.
Match Intensity
Light taps for navigation, medium impacts for actions, heavy for critical alerts.
Test on Device
Haptics don’t work in simulator. Always test on physical iPhone.
Graceful Fallback
Always wrap haptic calls in try/catch. Not all devices support all feedback types.
Status Bar
Control the appearance of the iOS status bar:Styling
Overlay WebView
Make the status bar transparent and overlay the web content:Background Color
capacitor.config.ts:19-22:
Show/Hide
Keyboard
Manage the on-screen keyboard behavior:Keyboard Events
Listen for keyboard show/hide events:src/lib/capacitor.ts:23-28.
Resize Behavior
Configure how the webview resizes when keyboard appears:body: Resize the body element (default)ionic: Use Ionic Framework’s resize logicnative: Use native platform behaviornone: Don’t resize, keyboard overlays content
Manual Control
Scroll into View
Ensure input fields are visible when keyboard appears:Splash Screen
Control the launch screen shown when app starts:Configuration
Manual Control
src/lib/capacitor.ts:34-37.
Custom Splash Screen
Replace default splash screen in Xcode:Additional Native Features
While not currently installed, Capacitor supports many other plugins:Camera
Filesystem
Geolocation
Local Notifications
Push Notifications
Building Custom Plugins
Create your own Capacitor plugin for custom native functionality: See Capacitor Plugin Guide for details.Debugging Native Code
Xcode Console
View native logs:- Open project in Xcode (
npx cap open ios) - Run the app (⌘R)
- Open Debug Area (⇧⌘Y)
- View Console tab for native logs
Safari Web Inspector
Debug web code running in the iOS app:- Enable Develop menu in Safari Preferences
- Connect iPhone and run app
- Safari menu: Develop > [Your iPhone] > Paw & Care
- Web Inspector opens with full DevTools
Log Native Events
Performance Tips
Lazy Import Plugins
Dynamically import heavy plugins to reduce initial bundle size.
Cache Plugin Instances
Reuse plugin instances instead of creating new ones for each call.
Minimize Bridge Calls
Batch operations when possible to reduce native ↔ web communication overhead.
Test on Real Devices
Simulator doesn’t accurately reflect real device performance.
Troubleshooting
Plugin Not Found
Error:Plugin [name] does not have web implementation
Solution:
- Ensure plugin is installed:
npm install @capacitor/[plugin] - Sync native project:
npx cap sync ios - Rebuild in Xcode
Permission Denied
Error:User denied permission
Solution:
- Add required permissions to
Info.plist- Camera:
NSCameraUsageDescription - Microphone:
NSMicrophoneUsageDescription - Location:
NSLocationWhenInUseUsageDescription
- Camera:
- Delete and reinstall app to trigger permission prompts
Method Not Implemented
Error:Not implemented on [platform]
Solution:
- Check plugin documentation for platform support
- Implement web fallback for unsupported platforms
- Consider using different plugin or custom implementation
Next Steps
iOS App
Learn about iOS app architecture and deployment
Offline Mode
Understand offline capabilities and sync strategies
Dictation
Explore voice recording and SOAP generation features
Capacitor Docs
Official Capacitor documentation and plugin reference