Swiftpack.co - Package - Zehua-Chen/brew-extension-gui

Brew Extension Client

This is a GUI Client of the swift package Zehua-Chen/brew-extension

alt text

Features

  • Adding and removing labels
  • Intelligent removal of dependencies
  • Marking a formulae as protected to prevent unintendded uninstallation

Future Work

Zehua-Chen/brew-extension was originally developed to be integrated into a command line application where all operations can be abstracted as following stages

  1. Read some data
  2. Do something with data according to user input
  3. Write the data back

However, when the package was being integrated into this GUI appilcation, the following issues arise

  1. More costly data reading and writing needs to happen off the main thread.
  2. When the data changes, other pieces of the application needs not only be notified of the changes, but also the details of the change.

Notification

The first problem right now is solved using NotificationCenter, where Notifications are dispatched using a string and the data associated with the notifications are dispatched using an untyped dictionary. At the moment, this approach does work but has the following pain points

  • It is very error prone to access the notification data as they are stored in an untyped dictionary

Async Database Access

The solution to the second problem is more straightforward, there is only one database operation done off the main thread, syncing data with homebrew, and all other operations are done on the UI thread

Very little risk is imposed here as when the syncing happens, a sheet is presented, thus preventing all other user input, ensuring that the thread where the syncing happens is the only one accesssing the database.

Obvioulsy this gets slow when there are a lot of data

In addition, no notification mechanism is implemented to inform view controllers that they need to update their views once the data finishes syncing.

Other Issues

  • The database protocol uses a mix of arrays and sets, making it confusing
  • The database protocol was not generic. It works great in the command line application environment where it is developed against predefined types, but not so much in GUI where the types representing datas are generated by Core Data.

TODOs

  • Research Combine, RxSwift to devise a more elegant notification system
  • Research Dispatch and CoreData's multithreading mechanisms to improve multithreading operations
  • Refactor the database types to be generic and consistant.

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

0.1.0 - Aug 15, 2019

Release the minimal working product