Snowman is a macOS status menu weather app written in SwiftUI.
- macOS 11.0+
- Swift 5.3+
- Xcode 12.0+
- An API key for a weather API service
To build and run the Snowman app:
-
Create an
AppConfiguration.plist
file by copying the templateAppConfiguration-template.plist
. -
Configure the default OpenWeather API or setup an API service of your choice.
The OpenWeather API is set as the default API service. To use it, simply configure your API key:
- Set your API key as the value for the
apiKey
in theAppConfiguration.plist
.
Note that distributing the app with an API key built-in is insecure and this approach is only acceptable for personal use or testing. For any distribution purposes, use a custom backend or the SnowmanBackend.
To use the SnowmanBackend, or any other custom backend, which provides a response that can be decoded using the SnowmanResponse
(i.e., it has the same format and contains all the required attributes):
-
Initialize the
SnowmanAPI
in theAppDelegate
with either of the following parameters:-
hostname
: the hostname and port of your server (e.g.,www.example.com:3000
); or -
url
: the full base URL of theforecast
resource (e.g.,https://www.example.com:3000/api/v1/forecast
).
-
If the response of your custom backend can be decoded using the SnowmanResponse
(i.e., it has the same format and contains all the required attributes), you can utilize the SnowmanAPI
(see SnowmanBackend). If it can't be, you need to implement the support for your custom service.
- Conform to the
APIServiceProtocol
. - Initialize the service in the
AppDelegate
and inject it into theLocationsListViewModel
.