SwiftUI menu bar app that shows the current temperature in Fahrenheit and Celsius, plus sun timing, UV index, and AQI.
Caution
This app was "vibe coded" with Opus 4.6, GPT-5.4, and Sonnet 4.6. Do not use it as is, do not trust this code!
- This version is intentionally minimal: one Swift source file plus this README.
- It uses IP-based geolocation instead of CoreLocation, so it does not need app bundles, entitlements, or location permission prompts.
- Weather and air-quality data come from Open-Meteo. IP lookup comes from ipapi.co.
- If YoLink credentials are configured, the menu bar temperature comes from your YoLink temperature/humidity sensor and the weather APIs remain fallbacks/context.
git clone <your-repo-url>
cd SwiftTemp
swiftc -parse-as-library -framework SwiftUI -framework AppKit -o SwiftTemp SwiftTemp.swift./SwiftTempThe app lives in the macOS menu bar and refreshes automatically every 10 minutes.
YoLink support is optional. Without these values, SwiftTemp keeps using the existing NWS/Open-Meteo source.
- In the YoLink app, create Personal Access Credentials from Account -> Advanced Settings -> Personal Access Credentials.
- Run the app with the credential values:
YOLINK_UAID="..." YOLINK_SECRET="..." ./SwiftTempIf your account has more than one YoLink THSensor, SwiftTemp shows a YoLink Sensor picker in the menu and remembers your choice. You can also hard-code a device with exact device values:
YOLINK_UAID="..." \
YOLINK_SECRET="..." \
YOLINK_DEVICE_ID="..." \
YOLINK_DEVICE_TOKEN="..." \
YOLINK_DEVICE_NAME="Outdoor North Side" \
./SwiftTempYou can get YOLINK_DEVICE_ID and YOLINK_DEVICE_TOKEN from YoLink's Home.getDeviceList API response. The app calls THSensor.getState every 10 minutes and displays the reported temperature, humidity, and report age.
Because this project is a bare executable rather than a bundled .app, the simplest startup option is a per-user launchd agent managed by the included script.
- Build the binary:
swiftc -parse-as-library -framework SwiftUI -framework AppKit -o SwiftTemp SwiftTemp.swift- Add it to startup:
./startup.sh addIf you use YoLink, set the YoLink environment variables when adding or updating the login item so launchd can pass them to the app:
YOLINK_UAID="..." YOLINK_SECRET="..." ./startup.sh add- If you rebuild the binary later, reload the login item:
./startup.sh update- To remove it from startup:
./startup.sh removeThe script writes ~/Library/LaunchAgents/com.kastner.swifttemp.plist pointing at the SwiftTemp binary in this checkout. If you move the checkout, run ./startup.sh update.