Dealing with Legacy Code
Navigating the App Store's Requirements
Legacy code: it's a term that often sends shivers down a developer's spine. Old frameworks, missing documentation, and absent original developers make it a complex maze to navigate. One such challenge threw me into the deep end recently, and I thought I'd share my experience, hoping it might resonate with or even help some of you.
In April 2020, Apple implemented a new requirement for the App Store. All app submissions now had to be built with Xcode 11. Furthermore, Xcode 11 needed macOS Mojave 10.14.3 or a later version to function. This move was a part of Apple's continual drive to ensure that apps offered on their platform are contemporary and deliver optimal experiences for users.
One of my clients approached me with a request to update their app to be compliant with these requirements. However, there was a catch: the app was built using React Native version 0.47.1. To get it to work with Xcode 11, I needed to upgrade React Native to version 0.63.2.
The transition from React Native 0.47.1 to 0.63.2 isn't a straightforward one. Here's a breakdown of what I did:
- Backup: Before anything else, I ensured that I had a backup of the entire app. It's essential to have a fallback if things go south.
- Gradual Upgrades: Jumping directly from 0.47.1 to 0.63.2 would be a massive leap, and issues would be difficult to pinpoint. I decided to take incremental steps, updating to intermediate versions first and addressing any issues at each stage.
- Dependency Management: With each React Native update, certain dependencies become obsolete or need updates. After updating React Native, I reviewed all dependencies and made necessary changes.
- Testing: After each upgrade, extensive testing was crucial. This helped ensure that no existing functionality was broken in the process. Automated tests played a significant role, but manual testing was invaluable to catch unforeseen UI/UX issues.
- Documentation: As I went through the update process, I documented each step, challenges faced, and their solutions. Not only does this serve as a guide for future updates, but it also fills the gap left by the original developers.
- Xcode 11 Compatibility: Once React Native was updated to 0.63.2, I shifted my focus to ensuring the app was fully compatible with Xcode 11. This involved minor adjustments to the app's settings and configurations.
Legacy code challenges, like the one I faced, are not just about understanding old code. They're also about understanding the evolving ecosystem in which the app operates. Apple's decision to enforce the use of Xcode 11 and React Native's continual evolution made this experience a classic example of the challenges developers face in the ever-changing tech world.
However, with systematic approaches, comprehensive testing, and thorough documentation, even the most daunting legacy code can be updated. The key is patience, persistence, and a lot of coffee!