Software Mansion Mariusz Stanisz Nov 20, 2024

Adding React Native to Signal Open Source App: Part 1 (iOS)

Article Summary

Mariusz Stanisz from Software Mansion just proved brownfield React Native integration doesn't have to be scary. He added RN to Signal's notoriously complex iOS codebase and documented every step.

This is a detailed walkthrough of integrating React Native into Signal's open source iOS app. Stanisz tackles the unique challenges of brownfield integration, from dependency management to AppDelegate inheritance, showing how each app requires a different approach beyond standard documentation.

Key Takeaways

Critical Insight

Brownfield React Native integration into Signal iOS required careful AppDelegate inheritance and dependency wrangling, but ultimately worked with just core RN files and targeted Swift changes.

Part 2 covers the Android integration, which brings its own unique set of challenges to the brownfield approach.

About This Article

Problem

Signal's iOS codebase needed AppDelegate to inherit from RCTAppDelegate. This meant Mariusz Stanisz had to override several methods while keeping the existing functionality intact and making sure the app didn't break.

Solution

Software Mansion selectively overrode methods in AppDelegate, focusing on application(_:didFinishLaunchingWithOptions:). They also added sourceURL and bundleURL implementations based on React Native's documentation.

Impact

The integration turned on hot reload and got the Metro bundler working properly. React Native screens could now launch from Signal's native chat interface by swapping a single button in ChatListViewController.swift.