Skip to content

A Native macOS App built using Swift UI and Combine

License

Notifications You must be signed in to change notification settings

LinkAndreas/Licenses

Repository files navigation

Version: 1.1 Swift: 5.3 Platforms: iOS License: MIT

MotivationArchitectureCreditsLicenseIssues

Licenses

Have you ever been asked to put together the list of licenses of all frameworks that are used within your iOS, iPad OS, or macOS app? Manually completing this task quickly becomes tedious but may be required due to legal- or customer requests.

To mitigate this issue, I developed Licenses, a native macOS app that automates this procedure by collecting and exporting your licenses into a single spreadsheet (CSV) file.

You can check out the latest version of Licenses in the Mac AppStore (Link)

Motivation

This project aims to explore the capabilities of Swift UI on the Mac and to examine whether both Swift UI and Combine are ready to be used in production. I have documented the steps that I took as well as the challenges that I faced when building the project in the following article:

  • Building a native macOS app using SwiftUI and Combine (GitHub) (Medium)

Architecture

Licenses, uses a redux-inspired architecture, as illustrated below, consisting of Data-, Bloc-, ViewStore- and UI-related components. This way, state changes only occur within the bloc's reducer function, transforming incoming actions as well as the current state to an updated state that is ultimately consumed by the UI.

Also, side effects are performed by returning publishers from the reducer resulting in additional actions that are sent to the bloc. Hence, asynchronous work is treated similarly to synchronous work in the way that it only affects the state from within the reducer. Thus, the correctness of the reducer and as such the correctness of all state changes becomes testable through unit tests.

Note that blocs are not directly connected to the UI, but rather via view stores that act as the main communication gateway of the view. As a result, domain-specific knowledge is not exposed, but rather gets translated into view-specific models that only include the formatted data that is ready to be shown in the UI. As an example, instead of passing repositories, i.e., [GitHubRepository], to the view directly, we can rather pass a list of items, i.e., [ListItem], where each item only consists of UI-related data (e.g., title or subtitle) and omits any internal data that is repository-specific. Similarly, view actions are translated into domain-specific actions that are forwarded by the view store to the bloc. Excluding business- and domain-specific knowledge out of the view keeps them lean and facilitates simplified previews using mock data in Xcode.

Credits

  • LicensePlist - Masayuki Ono (Reference)
  • The Composable Architecture - Point-Free] (Reference)
  • Redux like state Containers in SwiftUI - Swift with Majid (Reference)

License

This project is released under the MIT License. See LICENSE for details.

About

A Native macOS App built using Swift UI and Combine

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages