macOS: Menu bar app that fetches data periodically

I have an intermediate knowledge of swift on macOS (thanks to these tutorials!) but lack the building block knowledge to do this:

A lightweight app that runs on the menu bar (status bar). It periodically fetches web data (say every hour) and stores it. User can launch the “full” app from the menu bar app, or he can launch it from the usual Applications icon.

The menu bar app and main app share much of the same data manipulation code, but I don’t want to have the full app in memory all the time, since it’s UI heavy

I’d welcome pointers to how to split this app up. I’ve a feeling it involves CocoaPods but I lack enough knowledge about them to know if they act like Windows DLLs or not (ie loaded when needed)?

An analogous app would be Time Machine.

Thanks!

Hi @graemeing,
AFAIK, you can write a simple app that creates a menu item, and this can have a view controller. This view controller can be hidden and when you tap on the icon, this view controller is displayed to the user. The UI activities would happen when you display the view controller, the rest of the time the code to simply fetch data would run and update the menu items.

I will see if I can get around to getting you some sample code,

cheers,

Jayant

This topic was automatically closed after 166 days. New replies are no longer allowed.