March 19, 2018
👋 I'm Ritesh Gupta from New Delhi, 🇮🇳.
iOS Engineer (mostly Swift) who composes with Protocols, binds with <~ ReactiveSwift & decouples business logic with MVVM. These are my everyday programming style/tools. I code /encourage /talk /read mostly about them since I believe,
POP (Protocol Oriented Programming) abstracts out the generic components (be it UI /Model /Networking) which could be reused not just throughout the app but also across various apps. It really helps me write small snippets of code which follow the single responsibility principle (checkout ProtoKit for various examples).
ReactiveSwift makes asynchronous programming look like synchronous programming. I love the way you can bind any logic with any event which allows you to implement event driven programming easily. It also lets you approach a problem in a totally different way which could otherwise have taken a lot more time & effort with just callbacks & closures.
MVVM (Model-View-ViewModel), if implemented correctly, really segregates a business logic from its UI/Model/Network component. It actually makes your UI reusable since you can configure it with any viewmodel which conforms to its configuration protocol. It also helps in breaking a huge screen into multiple small viewmodels which can take care of single responsibilities.
During weekdays I power Over iOS app and previously worked at Fueled. I have been working with swift since it came out and have published over 15 apps completely written in swift (with POP, reactive-swift & mvvm). My iOS experience goes over 5 years though. When I'm not coding, you can find me tweeting about iOS/swift/protocols/swift-evolution or exploring Indian fusion cuisines on Instagram! Checkout the new season of Samurai Jack now & thank me later!
I have learned a lot from the Swift community via blogs, conferences, videos etc and thus I try to give back to the community as well via:
Recently I started my second medium publication, Swift Sundae, where I publish articles related to Swift & my programming styles / tools.
Child View Controllers, Part 1 –– If we are trying to refactor a massive view controller, probably embedding child view controllers is one of the ways to go about it. With this post, I'm starting a series where I'll experiment with this concept and share my findings with everyone.
Reactive <~ Closure –– It's about how to adapt a closure based api in order to have a reactive layer on top of it, without modifying any underlying logic (using ReactiveSwift).
MVVM, you had one job to do!? –– In the last couple of years, MVVM has gained some reputation in the iOS community. Every other conference has at least one talk on this topic. Almost every other blog post is talking about design patterns specially MVVM (like this one :p). All of this indicates that it must be very good at what it does. So let’s try to understand what it actually does 🤔.
Reusable View Layout using Protocol & MVVM –– It's about how we can reuse a view's layout with the help of a protocol & MVVM. I have shared how we can outline a view’s interface, essentially different configuration states, with a protocol which will enable us to inject different viewmodels into a view. In other words, the idea here is to design data agnostic modelling of a view layout.
Extend Swift Associated Types in Protocol to compose behaviour –– Associated Type is a great way to add generic constraints in a Swift protocol. This article aims to explain how we can extend the behaviour of associatedTypes of a child protocol while inheriting from its base protocol 🙌.
Compile time errors are good –– I like to think of compile-time and run-time as twins, compile-time being the 😇 (innocent ones) and run-times the 😈 (evil ones). Compile-time errors will help us avoid any mistakes that could cause their evil twins i.e. run-time errors to bug our product.
Status bar throwing tantrums in iOS 9+ ––
If you have ever overridden
preferredStatusBarStyle for a child controller which is part of a navigation stack, then you know by simply overriding in the respective child controller doesn't work. In this article I have shared a neat trick which you can use to make it work 💪.
The curious case of Optionals — #1 Emptiness –– Swift introduced optionals so that a variable could also have a state of emptiness. In this article I have shared my views on the relationship between emptiness & optionals.
How to be a good Bad-iOS-Dev –– If you are looking for an informative article then you have come to the wrong place! I am writing to share a few “things” about iOS that I have experienced, so that we all can have some 😆 time while your xcode is running or sipping a cup of tea or maybe in the middle of a boring meeting 😴
In my first medium publication I share swifty snippets that leverages the great power of Swift 🤘 It focuses on extensions, protocols, generics, functional programming, closures etc. If you think you have a swifty snippet which you would like to share with everyone then submit your post on swift-snippet publication and I’ll add it as a guest post :) Some of the most recent ones are (you can checkout the entire list here),
I enjoy coding & abstracting reusable components in iOS/Swift and converting them into pods for easy integration.
RGListKit –– It's a Protocol & MVVM based framework for populating UITableView & UICollectionView. It takes care of batch-reload as well which is powered by Dwifft. 150+ ⭐
TagCellLayout –– It's a ui-collection-view layout subclass that takes care of all the logic behind making tags like layout using UICollectionView. It also allows you to adjust the alignment of your layout i.e Left || Centre || Right. Now you just have to take care of your tag view and everything else is sorted. 100+ ⭐
RGDependencyInjector –– It lets you inject dependencies in a class which is otherwise difficult to initialize due to framework limitations. It uses a protocol based approach which makes it easy to adopt and extend. There's no magic of any sort happening anywhere, it's a very lightweight µ-framework which you can browse easily!
It safely converts
Any? into Value types! (useful for mapping api response)
RGRoutable –– It's a type based app routing mechanism which could potentially replaces segues.
RGProgressHUD –– It's an iOS progress HUD written in Swift. You can configure it with three modes - normal, blur & custom. It allows you to change appearance of various UI aspects like tintColor, backgroundColor, alpha etc.
I was one of leading organisers of Swift India Meetups & its Delhi chapter. It's aim is to conduct a meetup per month and so far we have had 16 successful chapters (I was part of first 13 meetups as an organiser) at different offices. You can join our slack group to say hi and stay connected :)
I believe that sharing knowledge is very important for any community to grow strong. Learning and educating give me peace and I try to share my opinions via swift meetups. Here are some of my recent talks,
Recently I have started speaking at Swift Conferences to share my swifty opinions. If you are one of the conference organisers and want me to speak on Protocols or MVVM or ReactiveSwift or App architectures then feel free to contact me, let's make it happen. Here's the last conference I gave a talk at,
try! Swift, Bangalore (18th November, 2017) I took a workshop on Swift which was designed for developers who are interested in learning iOS app development and Swift. It included some fundamental topics like properties, optionals, access-controls, functions, protocols, structs, generics, enumerations, functional programming & error handling.