Skredvarsel
The Skredvarsel (Avalanche warning) app is an iOS, iPadOS, and macOS application that provides daily avalanche warnings from the Norwegian Avalanche Warning Service API.
The main feature of the app is a set of beautiful widgets that can be added to the home screen on iOS and iPadOS, or the notification center on macOS. It is not intended to replace the official Varsom Regobs app, but rather complement it with an app taking full advantage of the Apple platforms. Hence the code name iVarsom.
The app is also a learning exercise for myself to learn how to build and distribute a SwiftUI app for iOS, iPadOS, watchOS, and macOS.
iOS and iPadOS
macOS
Beta testing
Join the beta testing group on TestFlight.
Learning points covered by the app
The app is primarily a learning exercise to familiarize myself with SwiftUI and modern development practices on iOS, iPadOS, macOS and watchOS. This section will list some of the concepts covered in the app, with references to the learning materials I used for the different topics.
SwiftUI
The app is developed entirely in SwiftUI. The first prototype was actually developed on an iPad using Swift Playgrounds. The built-in learning programmes in Swift Playground is a nice introduction to the Swift language and SwiftUI. However, due to the lack of Widget support I had to move to full Xcode for most of the development.
The app makes extensive use of SwiftUI previews, and the listed WWDC presentation was of great help to make the most of this feature.
The Introducing SwiftUI tutorial from Apple is also a great way to get familiar with SwiftUI.
- Introducing SwiftUI tutorial
- WWDC20: Introduction to SwiftUI
- WWDC20: App essentials in SwiftUI
- WWDC21: What's new in SwiftUI
- WWDC20: Structure your app for SwiftUI previews
- WWDC21: Add rich graphics to your SwiftUI app
- WWDC20: Data Essentials in SwiftUI
WidgetKit
Widgets is the key feature of the app, so I spent quite some time learning about Widgets. The app uses intents for configuration, including color customizations to the configuration interface.
- WWDC20: Meet WidgetKit
- WWDC20: Build SwiftUI views for widgets
- WWDC20: Widgets Code-along, part 1
- WWDC20: Widgets Code-along, part 2
- WWDC20: Widgets Code-along, part 3
- WWDC21: Principles of great widgets
- WWDC20: Add configuration and intelligence to your widgets
Localization
The app is localized in Norwegian and English language.
Swift Packages
The app uses the open source package DynamicColor in the DangerGradient.swift
file to dynamically generate the gradient background of the warning views.
Concurrency and asynchronous code
The app uses async/await
for network operations in the VarsomApiClient.swift
file.