โจ Build iOS/macOS widgets without Swift. Just JavaScript, JSX, and creativity.
ScriptWidget is a powerful widget development platform that lets you create native iOS and macOS widgets using JavaScript and JSX-like syntax. No Swift required!
Think of it as "React Native for Widgets" - but simpler and more flexible.
| Feature | Description |
|---|---|
| ๐ฅ๏ธ Cross-Platform | One codebase for iOS and macOS widgets |
| ๐จ JSX Support | Declarative UI with JavaScript XML syntax |
| โก Native Performance | Compiled to native Swift/SwiftUI |
| ๐ง Rich APIs | Access device sensors, data sources, and more |
| ๐ฑ Interactive Widgets | Tap, swipe, and interact with widgets |
| ๐จ Custom Styling | Full control over appearance |
| ๐ฆ Template Gallery | Pre-built templates to get started |
| ๐ Live Preview | See changes instantly in Xcode |
# Clone the repository
git clone https://github.com/everettjf/ScriptWidget.git
cd ScriptWidgetopen ScriptWidget/ScriptWidget.xcodeproj- Select your target (iOS Simulator or macOS)
- Press
Cmd + Rto build and run - Explore the example widgets in
Examples/
ScriptWidget/
โโโ ScriptWidget/ # Main app source
โ โโโ App/ # App entry point
โ โโโ Script/ # JavaScript runtime
โ โโโ Views/ # SwiftUI views
โ โโโ Resources/ # Assets and templates
โโโ Examples/ # Example widgets
โ โโโ HelloWorld/ # Simple widget
โ โโโ Weather/ # Weather widget
โ โโโ Calendar/ # Calendar widget
โ โโโ ... # More examples
โโโ Templates/ # Widget templates
โโโ Docs/ # Documentation
โโโ README.md
// A simple widget
function render() {
return (
<widget type="medium">
<text style={{ fontSize: 24, color: '#333' }}>
Hello, ScriptWidget! ๐
</text>
</widget>
);
}function WeatherWidget({ location }) {
const [weather] = useWeather(location);
return (
<widget type="large">
<view style={{ padding: 16 }}>
<text style={{ fontSize: 32 }}>
{weather.temperature}ยฐC
</text>
<text style={{ fontSize: 16 }}>
{weather.condition}
</text>
</view>
</widget>
);
}function TodoList({ todos }) {
return (
<widget type="medium">
<list data={todos} render={(item) => (
<row>
<checkbox checked={item.done} />
<text>{item.title}</text>
</row>
)} />
</widget>
);
}- Xcode 14+ (for iOS 16+ / macOS 13+)
- macOS 13+ (Ventura or later)
- iOS 16+ (for iOS widgets)
# Clone and setup
git clone https://github.com/everettjf/ScriptWidget.git
cd ScriptWidget
# Open in Xcode
open ScriptWidget/ScriptWidget.xcodeproj
# Build and run (Cmd + R)# 1. Duplicate an example
cp -r Examples/HelloWorld Examples/MyWidget
# 2. Edit the JavaScript file
cd Examples/MyWidget
vim script.js # Write your widget code
# 3. Run and preview in the app- Widget Types - small, medium, large, accessory
- Components - text, image, list, grid, etc.
- Styling - CSS-like inline styles
- Data Sources - weather, calendar, reminders, etc.
- Interactions - tap, swipe, long press
| API | Description |
|---|---|
useWeather() |
Get weather data |
useCalendar() |
Access calendar events |
useReminders() |
Fetch reminder lists |
useLocation() |
Get device location |
useHealth() |
HealthKit data |
useNetwork() |
Network requests |
| Platform | Support | Notes |
|---|---|---|
| iOS | โ Full | iOS 16+ (iPhone, iPad) |
| macOS | โ Full | macOS 13+ (Mac) |
| watchOS | ๐ Planned | Future release |
| visionOS | ๐ Planned | Future release |
Contributions are welcome! Please read our Contributing Guide for details.
- ๐ Report bugs
- ๐ก Suggest features
- ๐ง Submit pull requests
- ๐ Write documentation
- ๐จ Share your widgets
ScriptWidget is released under the MIT License.
Built with:
- JavaScriptCore - Apple's JavaScript engine
- SwiftUI - Modern UI framework
- Xcode Gen - Project generation
Inspired by:
- React - Component-based UI
- React Native - Mobile development
- WidgetKit - Apple's widget framework
ๆ้ฎ้ข๏ผๅป Issues ๆ้ฎ๏ผ
Made with โค๏ธ by Everett
Project Link: https://github.com/everettjf/ScriptWidget

