Open Sourcing Twitter Network Layer
In 2014, iOS 7 was released with the new
NSURLSession
API for networking to replaceNSURLConnection
(which ended up being deprecated in iOS 9). At Twitter, we wanted to modernize our original network code and design something scalable and robust that would last at least the next 10 years. We took that opportunity to assess the drawbacks of the system we had in place and enumerated all the possible improvements we could build in an encapsulated framework that was modern and scalable.Twitter Network Layer (TNL) was first built in 2014 and over the course of the next two years, we transitioned everything over to TNL while iterating on the framework. TNL has now been in production for 4 years, 100% adopted for over 2 years, and has had no bugs identified in the last 18 months.
[…]
There is an additional benefit of having TNL abstract away
NSURLSession
instances, which is an automatic performance gain of reducing the number ofNSURLSessions
that would need to be created.