Skip to content

Repository files navigation

GoldPrice for macOS

English | 简体中文

GoldPrice is a native SwiftUI macOS menu bar app for tracking live international gold prices in USD / OZ and RMB / g, with a desktop widget and a dedicated detail window.

Platform SwiftUI Widget

Preview

Dashboard

Dashboard Preview

Menu Bar Panel

Menu Bar Preview

Features

  • Persistent menu bar entry for quick price lookup
  • Second-level refresh in the main app
  • USD / OZ and RMB / g primary price display
  • Manual source switching: Auto, Kitco, Gold API
  • Detail window with a short-range price chart
  • systemSmall and systemMedium desktop widgets
  • Native SwiftUI implementation without third-party dependencies

Requirements

  • macOS 14 or later
  • Xcode 15 or later
  • Network access to public price sources

Quick Start

  1. Open GoldPrice.xcodeproj in Xcode.
  2. Select the GoldPrice scheme.
  3. In Signing & Capabilities, assign a Team for both GoldPrice and GoldPriceWidgetExtension.
  4. If the default com.example.* bundle identifiers conflict, replace them with your own.
  5. Choose My Mac as the run destination.
  6. Press Cmd + R.

After the first launch, the main entry lives in the macOS menu bar. Click the live price item to open the panel, then use Detail to open the full window.

Documentation

Chinese versions:

Data Sources

The app currently supports the following modes:

  • Auto: prefers Kitco, falls back to Gold API
  • Kitco: parses live data directly from the Kitco chart page
  • Gold API: uses https://api.gold-api.com/price/XAU

RMB / g is calculated from USD/CNY data parsed alongside the quote source. If exchange-rate parsing fails, the RMB price is shown as --.

Refresh Policy

  • Menu bar panel and detail window: refresh every second
  • Widget: refresh frequency is controlled by WidgetKit

That means true second-level updates only apply to the main app, not to the widget. The short-range line chart only advances when the quote source delivers a fresh sample.

Project Structure

GoldPriceApp/
  GoldPriceApp.swift
  MenuBarViews.swift
  ContentView.swift
  GoldPriceViewModel.swift

GoldPriceWidget/
  GoldPriceWidget.swift

Shared/
  GoldPriceService.swift
  GoldPriceModels.swift
  Formatting.swift
  GoldPriceTheme.swift

docs/
  assets/
  USAGE.md
  USAGE.zh-CN.md
  BUILD_AND_RELEASE.md
  BUILD_AND_RELEASE.zh-CN.md

scripts/
  generate_app_icon.swift
  generate_icon_concepts.swift
  generate_readme_previews.swift
  render_menu_header_preview.swift

Local Build

Unsigned local build:

DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild \
  -project GoldPrice.xcodeproj \
  -scheme GoldPrice \
  -configuration Debug \
  -derivedDataPath ./.build/DerivedData \
  CODE_SIGNING_ALLOWED=NO \
  CODE_SIGNING_REQUIRED=NO \
  build

Known Limitations

  • Widgets cannot refresh every second
  • Price parsing depends on third-party page structure and public endpoints
  • The repository does not include signing or notarization automation
  • The repository does not currently include a LICENSE

Contributing

Issues and pull requests are welcome. Read Contributing before making larger changes.

License

No license file is included yet. If you plan to publish the repository publicly, define the license before release.

About

A native macOS menu bar app for tracking live gold prices in USD/oz and RMB/g, with source switching, a dashboard window, and Widget support.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages