Overview
Dynamic strings allow you to update your iOS app’s text content instantly without submitting a new version to the App Store. Change marketing copy, fix typos, run time-sensitive campaigns, or adjust messaging—all from the Stringboot Dashboard.Key Benefits
Instant Updates
Change text content without app releases or user updates
Offline-First
Strings cached locally—works without internet connection
SwiftUI Native
Use
SBText for automatic string injectionReactive UI
Combine publishers for automatic UI updates
Quick Start
1. Add String to Dashboard
Go to Stringboot Dashboard → Strings → Add New String:- Key:
welcome_message - Value:
"Welcome to our app!" - Language:
en
2. Use in Your App
- SwiftUI - SBText (Recommended)
- SwiftUI - Async/Await
- UIKit - SBLabel
ContentView.swift
3. Update from Dashboard
Go to Strings → Editwelcome_message → Change to "Welcome back!" → Save
Your app automatically shows the new text next time it syncs (happens automatically on app launch).
String Retrieval Methods
1. SBText (SwiftUI - Recommended)
The simplest method for SwiftUI apps: auto-updating text views.ProductView.swift
- Zero boilerplate code
- Automatically updates when language changes
- Perfect for static layouts
- Handles missing strings gracefully
- Most Text views in SwiftUI
- Marketing pages and static content
- Forms with static labels
2. Async/Await
Get strings asynchronously with Swift’s modern concurrency.- Dialogs and alerts
- Non-critical string retrieval
- When you need strings before UI renders
3. Combine Publishers
Use Combine for reactive string updates.- Automatically updates when string changes
- Updates when network sync completes
- Perfect for dynamic content
- Integrates with existing Combine code
- Content that changes based on user actions
- Status messages and live updates
- Templates with dynamic formatting
- MVVM architectures
Advanced Patterns
Get Multiple Strings at Once
Fetch multiple strings efficiently in a single query.- Single database query instead of multiple
- More efficient for bulk retrieval
- Returns a
[String: String]dictionary
String Templates with Formatting
Use string templates with dynamic values. Dashboard String:Preloading Strings for Performance
Preload frequently used strings into memory cache for instant access.- App startup
- Before showing a complex screen with many strings
- After language switching
- Instant string retrieval
- Eliminates database queries
- Reduces perceived lag
Refresh Strings from Network
Manually trigger a network sync to get latest strings.- Fetches latest strings from server
- Updates local Core Data database
- Clears memory cache
- Publishers automatically emit new values
List/Collection Integration
SwiftUI List with SBText
ProductListView.swift
UIKit TableView
ProductCell.swift
Handling Missing Strings
Fallback Behavior
When a string key doesn’t exist, Stringboot returns the key itself:Provide Default Values
Check if String Exists
Best Practices
Use SBText for Static Content in SwiftUI
Use SBText for Static Content in SwiftUI
Recommended:Avoid:SBText automatically handles updates and lifecycle.
Use Combine Publishers for Dynamic Content
Use Combine Publishers for Dynamic Content
Recommended:Avoid:Publishers automatically update when content changes.
Preload Before Heavy Screens
Preload Before Heavy Screens
Use @MainActor for UI Updates
Use @MainActor for UI Updates
Common Use Cases
Marketing Campaigns
Update promotional messages instantly without app updates. Dashboard Strings:campaign_banner_title: “50% Off All Items!”campaign_banner_subtitle: “Limited time offer - ends Friday”campaign_cta_button: “Shop Now”
Seasonal Content
- December: “seasonal_greeting” = “Happy Holidays!”
- January: “seasonal_greeting” = “Happy New Year!”
- Spring: “seasonal_greeting” = “Spring Sale!”
Fix Typos Instantly
Found a typo in production? Fix it immediately from the dashboard. Before:Next Steps
Translations
Add multi-language support and language switching
A/B Testing
Optimize messaging with experiments
Best Practices
Production patterns and optimization
API Reference
StringProvider Methods
| Method | Description | Returns |
|---|---|---|
get(_ key, lang?) | Get string asynchronously | async String |
getPublisher(for:lang:) | Get Combine publisher for string | AnyPublisher<String, Never> |
getMultiple(_ keys, lang?) | Get multiple strings | async [String: String] |
preloadLanguage(lang, maxStrings?) | Preload strings into cache | async Void |
refreshFromNetwork(lang:) | Sync latest strings from server | async Bool |
SwiftUI Components
| Component | Description |
|---|---|
SBText(_ key) | Auto-updating Text view |
SBLabel(key:) | UIKit auto-updating label |
Troubleshooting
SBText shows key instead of value
SBText shows key instead of value
Causes:
- String key doesn’t exist in dashboard
- Network sync hasn’t happened yet
- String not in cache or database
- Verify key exists in Stringboot Dashboard
- Call
await StringProvider.shared.refreshFromNetwork()to sync - Check logs with
StringbootLogger.isLoggingEnabled = true
UI doesn't update when string changes in dashboard
UI doesn't update when string changes in dashboard
For SBText:
SBText automatically updates—check if SDK initialized correctly.For manual updates:
Performance issues with many strings
Performance issues with many strings
Use preloading:Batch retrieve: