Overview
Smart widgets allow your app to display information on the iOS home screen without users opening the app. These widgets can show real-time data, statistics, or any content served as an SVG or PNG image, updating automatically at specified intervals.
Prerequisites
Despia Configuration
-
Open your Despia editor
-
Navigate to Targets
-
Enable Smart Widget
-
Configure widget settings:
-
Name: Your widget display name
-
Description: Widget description for users
-
Server Fallback URL: Default widget content URL
-
Refresh Rate: Update frequency (e.g., 1, 5, or 10 minutes)
-
-
Rebuild and republish your application
WeWeb Setup
-
Install the Despia plugin from WeWeb Marketplace
-
Verify installation: Assets → Library → check for "Despia"
Implementation Steps
Step 1: Add Despia Plugin Component
-
Click Add in WeWeb editor
-
Navigate to Assets panel
-
Find Despia native → Despia plugin component
-
Drag to the top of your page
Step 2: Create Widget Update Trigger
Add a trigger for updating the widget URL (typically after user login):
-
Button for manual update
-
On successful authentication
-
After user preferences change
-
When user data updates
Step 3: Configure Widget Update Workflow
-
Select your trigger element
-
Go to Workflows → Add workflow
-
Add action: Execute component action
-
Component: Despia plugin
-
Action: "Set widget, no callback"
-
Refresh Time: Minutes between updates (e.g., 60)
-
Endpoint: URL serving your widget content
-
Widget Content Requirements
Supported Formats
-
SVG: Recommended for scalable, dynamic content
-
PNG: Static images with fixed dimensions
Dynamic Content Strategy
Your server endpoint should:
-
Accept user ID as query parameter
-
Fetch relevant user data from database
-
Generate personalized SVG/PNG
-
Return updated content on each request
Example Use Cases
-
Sales dashboards with revenue numbers
-
Fitness stats showing daily progress
-
Task counters displaying pending items
-
Weather data for user's location
-
Stock portfolio values
Server Setup Considerations
Endpoint Requirements
-
Must be publicly accessible
-
Should handle authentication tokens
-
Return proper content-type headers
-
Optimize for quick response times
Implementation Options
-
Cloudflare Workers for edge computing
-
Xano endpoints with dynamic SVG generation
-
Supabase functions with database queries
-
Custom backend API endpoints
Dynamic Widget Updates
Setting User-Specific Widgets
After user authentication, update the widget URL to include user context:
-
Base URL + user ID parameter
-
Authenticated endpoint with token
-
Personalized content based on preferences
Refresh Strategies
-
Static Content: Longer refresh intervals (60+ minutes)
-
Real-time Data: Shorter intervals (1-5 minutes)
-
Battery Consideration: Balance update frequency with battery usage
Publishing & Deployment
-
Widget configuration changes use over-the-air updates
-
No App Store resubmission required for URL changes
-
Instant deployment to all users
-
Widget setup requires initial app rebuild
Best Practices
-
Fallback Content
-
Always provide default widget for logged-out state
-
Show placeholder when data unavailable
-
Handle network errors gracefully
-
-
Performance
-
Keep widget content lightweight
-
Optimize image file sizes
-
Cache when appropriate
-
Minimize server response time
-
-
User Experience
-
Make widgets visually appealing
-
Display most relevant information
-
Use clear, readable fonts
-
Consider different widget sizes
-
-
Security
-
Don't expose sensitive data without authentication
-
Use secure HTTPS endpoints
-
Validate user permissions
-
Implement rate limiting
-
Widget Sizes & Layout
iOS supports multiple widget sizes:
-
Small: Limited space, key metrics only
-
Medium: More detail, basic charts
-
Large: Full dashboard views
Design your SVG content to scale appropriately for each size.
Testing Your Widget
-
Deploy widget configuration in Despia
-
Install app on test device
-
Long-press home screen
-
Add widget from your app
-
Verify initial display
-
Trigger update from WeWeb app
-
Confirm widget refreshes
Troubleshooting
Widget not appearing:
-
Verify widget enabled in Despia
-
Check app was rebuilt after enabling
-
Ensure iOS version supports widgets
Widget not updating:
-
Verify endpoint is accessible
-
Check refresh rate settings
-
Test endpoint returns valid content
-
Confirm workflow triggers correctly
Content display issues:
-
Validate SVG/PNG format
-
Check image dimensions
-
Verify content-type headers
-
Test with static content first
For additional support or questions, please contact our support team at support@despia.com