Engineers Detail Extensive Efforts to Rewrite Facebook iOS App - MacRumors
Skip to Content

Engineers Detail Extensive Efforts to Rewrite Facebook iOS App

by

NewImageFacebook employee Jonathan Dann has written a blog post detailing how the company's iOS engineering team designed earlier Facebook for iPhone apps and the extensive coding that was required to rewrite the new Facebook 5.0 app.

The post is a bit technical in parts, but is worth a read for developers and others interested in how one of the most popular iPhone apps gets made.

An excerpt:

One of the biggest advantages we've gained from building on native iOS has been the ability to make the app fast. Now, when you scroll through your news feed on the new Facebook for iOS, you'll notice that it feels much faster than before. One way we have achieved this is by re-balancing where we perform certain tasks. For example, in iOS, the main thread drives the UI and handles touch events, so the more work we do on the main thread, the slower the app feels. Instead, we take care to perform computationally expensive tasks in the background. This means all our networking activity, JSON parsing, NSManagedObject creation, and saving to disk never touches the main thread.

To give another example, we use Core Text to lay out many of our strings, but layout calculations can quickly become a bottleneck. With our new iOS app, when we download new content, we asynchronously calculate the sizes for all these strings, cache our CTFramesetters (which can be expensive to create), and then use all these calculations later when we present the story into our UITableView.

Finally, when you start Facebook for iOS, you want to see your news feed, not a loading spinner. To provide the best experience possible, we now show previously-cached content immediately. But this introduces a new problem: If you have a lot of stories in your news feed, UITableView throws a small spanner in the works by calling the delegate method -tableView:heightForRowAtIndexPath: for each story in your news feed in order to work out how tall to make its scrollbar. This would result in the app loading all the story data from disk and calculating the entire story layout solely to return the height of the story, meaning startup would get progressively slower as you accumulate more stories.

The solution to this particular problem has two main parts. Firstly, when we do our initial asynchronous layout calculations, we also store the height of the story in Core Data. In doing so, we completely avoid layout calculation in -tableView:heightForRowAtIndexPath:. Secondly, we've split up our "story" model object. We only fetch the story heights (and a few other things) from disk on startup. Later, we fetch the rest of the story data, and any more layout calculations we have to do are all performed asynchronously.

Top Rated Comments

186 months ago
Hate to see if they had to work on a game or some other app that really required good coding skills.

I guess making an app to download cat pics and "I'm going to bed now!" messages was tough work.



Michael

Do you have programming experience?
Score: 19 Votes (Like | Disagree)
Pakaku Avatar
186 months ago
It's marginally better. Completely rewritten, huh? So instead of making actual improvements on the UI in the process, they kept the same limited capabilities and just made the app start up a little faster.

Still no way to share posts.
I don't use the facebook app, but I'm pretty sure I'd like a decent, usable app that's missing a few features, rather than a terrible, laggy app.
Score: 13 Votes (Like | Disagree)
Tinmania Avatar
186 months ago
Hate to see if they had to work on a game or some other app that really required good coding skills.

I guess making an app to download cat pics and "I'm going to bed now!" messages was tough work.



Michael
Score: 13 Votes (Like | Disagree)
186 months ago
Nah.... just how I have earned my living for the last 11 years. That's all lol.

Sorry, it's just that your comment makes it seem like you have never coded anything of quality. Just because it can display cat pictures doesn't make it trivial. I would expect anyone with experience to respect the work that went into this app, especially after reading the linked article.
Score: 9 Votes (Like | Disagree)
186 months ago
It's always great to see real-world hard-won experience doled out like this.

To those mad there aren't more changes, rebuilding is hard. New features are hard too. Don't do both at once. Rebuilding makes future changes easier.
Patience. Mobile users barely make Facebook money anyway.
Score: 7 Votes (Like | Disagree)
186 months ago
Hate to see if they had to work on a game or some other app that really required good coding skills.

I guess making an app to download cat pics and "I'm going to bed now!" messages was tough work.



Michael

Never coded before, have you? Games are difficult but nowhere near the most challenging.
Score: 6 Votes (Like | Disagree)

Popular Stories

iPhone Duo Outer Display Hand

Apple Aiming to Upgrade the iPhone Duo in Four Ways

Sunday November 15, 2026 8:42 am PST by
Bloomberg's Mark Gurman today said Apple has four goals for future iPhone Duo models: Face ID, an Action button, a telephoto camera, and a thinner-and-lighter design. Gurman said Apple has already developed iPhone Duo 2 prototypes with Face ID on the outer display, but it is "running out of time" to finalize the feature for that model, so it might not arrive until the iPhone Duo...
Apple Health AI Study App Feature

Apple Just Released a New App

Monday November 16, 2026 9:43 am PST by
Apple today launched a new research study in the U.S. to explore the use of AI for health, and it has released a dedicated iPhone app for participants. In a press release, Apple said the study and app are "designed to advance the understanding of how people interact with conversational health AI tools." The Apple Health AI Study App contains a generative AI chatbot that participants can...
iphone duo yellow hand

Apple Adds Facial Unlock Option on iPhone Duo in iOS 27.3

Monday November 16, 2026 10:17 am PST by
Apple today added a new option for unlocking the iPhone Duo using the front-facing camera, giving device users multiple ways to access their content. The feature is available in the second iOS 27.3 beta. The option to unlock with facial recognition is only available on the Lock Screen, and authentication via Touch ID is still needed for Apple Pay purchases, adding passwords and logins, and...
Latest Stories
Aqara Debuts Six Matter Smart Lights That Work With Apple Home
Aqara Debuts Six Matter Smart Lights That Work With Apple Home
2 hours ago
Disney+ and Hulu Will Fully Merge Into One App in December
Disney+ and Hulu Will Fully Merge Into One App in December
2 hours ago
iFixit Says Apple's HomeView is Unnecessarily Hard to Repair
iFixit Says Apple's HomeView is Unnecessarily Hard to Repair
5 hours ago
Final Cut Pro Now Includes MotionVFX for Creator Studio Users
Final Cut Pro Now Includes MotionVFX for Creator Studio Users
5 hours ago
Apple Blames Internal Update for Outage, Says It Wasn't a Cyberattack
Apple Blames Internal Update for Outage, Says It Wasn't a Cyberattack
7 hours ago
Nomad Launches Black Friday Sale With Up to 30% Off Apple Accessories
Nomad Launches Black Friday Sale With Up to 30% Off Apple Accessories
8 hours ago
Google Wallet Available on iPhone, But Without Tap to Pay
Google Wallet Available on iPhone, But Without Tap to Pay
8 hours ago
Apple Accounts, App Store and Apple Music Experiencing Issues
Apple Accounts, App Store and Apple Music Experiencing Issues
8 hours ago
Apple Moves Ahead With Better Dual SIM Support for Apps
Apple Moves Ahead With Better Dual SIM Support for Apps
9 hours ago
Former Apple Chairman Plans to Sell $32 Million in Apple Stock
Former Apple Chairman Plans to Sell $32 Million in Apple Stock
10 hours ago
Apple Accused of Silencing iPhone Duo Supplier Over 'Crackgate' Issue
Apple Accused of Silencing iPhone Duo Supplier Over 'Crackgate' Issue
10 hours ago
Apple Store App Now Optimized for iPhone Duo
Apple Store App Now Optimized for iPhone Duo
10 hours ago
Apple Says iCloud+ Plans Will Not Include Increased Siri AI Usage in UK
Apple Says iCloud+ Plans Will Not Include Increased Siri AI Usage in UK
11 hours ago
Amazon Offering Early Black Friday Discounts on TVs, Headphones, and Charging Devices
Amazon Offering Early Black Friday Discounts on TVs, Headphones, and Charging Devices
11 hours ago
Apple Now Sells DIY Repair Parts for iPhone Duo
Apple Now Sells DIY Repair Parts for iPhone Duo
11 hours ago
iPhone 20 Pro Screen Protectors Show Rumored Curved Design
iPhone 20 Pro Screen Protectors Show Rumored Curved Design
12 hours ago
MacBook Neo Black Friday Deals Arrive With $49 Discounts on Nearly Every Model at Amazon
MacBook Neo Black Friday Deals Arrive With $49 Discounts on Nearly Every Model at Amazon
13 hours ago
iPhone Users Targeted in Major Website Security Breach
iPhone Users Targeted in Major Website Security Breach
14 hours ago
Apple Names 'Baby, This Is Keke Palmer' Podcast of the Year
Apple Names 'Baby, This Is Keke Palmer' Podcast of the Year
14 hours ago
Apple Tests Bringing Back a Softer Side of Liquid Glass
Apple Tests Bringing Back a Softer Side of Liquid Glass
15 hours ago
Apple Close to Rare Long-Term Memory Deal With Samsung
Apple Close to Rare Long-Term Memory Deal With Samsung
16 hours ago
Everything New in iOS 27.3 Beta 2
Everything New in iOS 27.3 Beta 2
1 day ago
Apple Plans to Release These 18 New Products Next Year
Apple Plans to Release These 18 New Products Next Year
1 day ago
New Apple TV 4K Discount Returns at Amazon
New Apple TV 4K Discount Returns at Amazon
1 day ago
iPhone Duo Orders Will Now Arrive Before the Holidays
iPhone Duo Orders Will Now Arrive Before the Holidays
1 day ago
Hands-On With the iPhone Duo's New Face Unlock
Hands-On With the iPhone Duo's New Face Unlock
1 day ago
macOS 27.3 Warns Against Giving AI Apps Full Mac Control
macOS 27.3 Warns Against Giving AI Apps Full Mac Control
1 day ago
iPad and Mac Get Apple Intelligence in China in 27.3 Betas
iPad and Mac Get Apple Intelligence in China in 27.3 Betas
1 day ago
Apple News+ Puzzles Come to UK, Australia, and French Canada
Apple News+ Puzzles Come to UK, Australia, and French Canada
1 day ago
macOS Golden Gate 27.3 Beta 2 Now Available for Developers
macOS Golden Gate 27.3 Beta 2 Now Available for Developers
1 day ago