Access the Brave iOS codebase
developmenthttps://github.com/brave/brave-core. This repository is slated for archiving and should no longer be used as the primary source for iOS development.repository·development·Indexed 23 days ago
https://github.com/brave/brave-iosThe mobile browser application for Apple's iOS platform. This repository includes documentation for localization via Transifex, project configuration using local templates, and development workflows for BraveCore, including building xcframeworks and running unit tests. Note that primary development and the codebase have migrated to the brave-core repository.
https://github.com/brave/brave-core. This repository is slated for archiving and should no longer be used as the primary source for iOS development.Dynamic Scripts are scripts within the Brave for iOS environment that are not processed via Webpack or NPM. Unlike standard web-packed scripts, these are loaded directly.
Security Requirement: Every Dynamic Script must implement a message handler. If a script is not sandboxed, developers are responsible for ensuring the message handler is properly secured to prevent unauthorized access or exploitation.
Static is designed to separate model data from presentation by using Rows and Sections as view models for cells.
Row: Represents a single row in a section. It holds data like text, detailText, and accessory types, and handles selection logic.Section: A collection of Rows. It can include a header and footer.DataSource: The bridge between your data and the UITableView. You assign your Sections to the DataSource and then assign the DataSource to your tableView.Important: Do not manually change the dataSource or delegate of your UITableView. The DataSource object must manage these to handle events correctly.
To pull the latest translations from Transifex into the local Xcode project, run the pull-translations-into-project.sh script from the l10n/ directory. Errors are logged to output.log.
Note: Before importing, be aware that the xcodebuild command-line tool used in this process does not allow specifying the import destination folder and may add duplicate .strings entries to the Copy Bundle Resources section of Build Phases. These duplicates must be removed manually.
cd l10n/
USERNAME=<username> PASSWORD=<password> ./pull-translations-into-project.shWhen making changes to files in the ios directory of brave-core, you must update BUILD.gn if any files are added or removed. Use npm run build with specific flags to generate the required builds.
Build Commands:
npm run build -- Debug --target_os=iosnpm run build -- Debug --target_os=ios --target_arch=arm64 --target_environment=simulatornpm run build -- Release --target_os=iosnpm run build -- Release --target_os=ios --target_arch=arm64# Creates debug build
npm run build -- Debug --target_os=ios
# Creates iOS simulator debug build (required to run on Apple Silicon simulators)
npm run build -- Debug --target_os=ios --target_arch=arm64 --target_environment=simulator
# Creates release build
npm run build -- Release --target_os=ios
# Creates arm64 build
npm run build -- Release --target_os=ios --target_arch=arm64You can install the Static library using Carthage, CocoaPods, or by adding it manually to your project.
Add the following to your Cartfile:
Ensure CocoaPods version 0.37 or greater is installed. Update your Podfile with:
Add the project as a subproject to your project or workspace and add the appropriate framework as a target dependency.
github "venmo/Static"use_frameworks!
pod 'Static', git: 'https://github.com/venmo/Static'After the initial setup, you can update your local brave-core to the latest master branch and sync the latest Chromium version using the sync command.
cd /path/to/brave-browser/src/brave
git checkout master && git pull
npm run sync --target_os=iosNew strings must be added statically to the Strings.swift file within the en_US locale. Use the following pattern:
extension Strings {
public static let someString = NSLocalizedString("SomeString", value: "Some String", comment: "Comments are used to bring context to the string to aide others")
}node_modules/brave-core-ios directory of your project.After adding new strings to Strings.swift, push them to Transifex by running the push-strings-to-transifex.sh script from the l10n/ directory. Any errors encountered during the push will be logged to output.log.
cd l10n/
USERNAME=<username> PASSWORD=<password> ./push-strings-to-transifex.shTo ensure code strings are properly tokenized and managed, you must install the following dependencies via Terminal:
sudo easy_install pipsudo -H pip install tornadosudo -H pip install lxmlsudo easy_install pip
sudo -H pip install tornado
sudo -H pip install lxmlTo develop with BraveCore, you must first set up the brave-browser repository and its dependencies.
Prerequisites:
brave-browser repository.brave-browser wiki.PATH.npm install in the brave-browser directory.Initial Setup: Run the following commands to initialize the iOS target:
cd brave-browser
git checkout -- "*" && git pull
npm run init -- --target_os=ios