Skip to content

Working with BrowserKit

OrlaM edited this page Jun 20, 2023 · 2 revisions

BrowserKit is a local Swift package in the firefox-ios repository. It contains multiple libraries that are currently used by the Firefox iOS client app. The package is structured in a way that allows in-line editing of the libraries from within the same Xcode project as the Firefox iOS app code, changes made to the libraries are consumed immediately without needing to deal with releases or semantic versioning.

Purpose

The main goal of building out this package is to modularize the codebase. The current lack of separation of concerns is a significant issue in the codebase. Although the app is broken out into several targets, many files are shared across multiple targets. Using targets in this way does not enforce good boundaries in the code, which is not an ideal solution. Independent libraries do a better job of enforcing proper separation, as it becomes very difficult to have code that lives in the client target exposed to these libraries.

What to put into it

Any code that is logically tied to the existing libraries should be included in BrowserKit. For example, anything that adds functionality to tab storage should go into the TabDataStore library.

For single classes or lightweight utilities that are intended to be shared across libraries, it often makes the most sense to add them to the Common library. Creating an entire library for such components would introduce unnecessary overhead.

When building out a new feature or refactoring code in the existing codebase, any large block of self-contained code would likely make sense to put in a new library within BrowserKit.

Clone this wiki locally