Brew Extension Client
This is a GUI Client of the swift package Zehua-Chen/brew-extension
- Adding and removing labels
- Intelligent removal of dependencies
- Marking a formulae as protected to prevent unintendded uninstallation
Zehua-Chen/brew-extension was originally developed to be integrated into a command line application where all operations can be abstracted as following stages
- Read some data
- Do something with data according to user input
- Write the data back
However, when the package was being integrated into this GUI appilcation, the following issues arise
- More costly data reading and writing needs to happen off the main thread.
- When the data changes, other pieces of the application needs not only be notified of the changes, but also the details of the change.
The first problem right now is solved using
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.
- 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.
RxSwiftto devise a more elegant notification system
CoreData's multithreading mechanisms to improve multithreading operations
- Refactor the database types to be generic and consistant.