AppDelegate Lifecycle 🥚🐣🐥🐓

Introduction to AppDelegate Lifecycle methods and useful supporting methods

Varga Zolt
Geek Culture

--

Photo by Clemens van Lay on Unsplash

Introduction

AppDelegate is a set of methods to manage shared behaviours for your app. I would say “The Singleton” of the application. In reality it is the central place where developers initialised the apps data structures, App Scenes / Views configured, Push Notification, Location Services configured, 3rd Party Frameworks Initialised (e.g.: Firebase, Realm, Facebook SDK) etc.
But this is just a wrong setup and the way to build MassiveAppDelegate, by accumulating all these services in one place.

There is a way to structure it nicely and to separate every component with little magic and with help of Composite Design Pattern. This solution will be shown with the example below. Look at the MyCustomAppDelegate.swift class as an example. It extracts and groups one kind of service in one place.

AppDelegate Lifecycle

In this section I will introduce the Lifecycle Methods, some not so known methods. I will tell you some use cases what I wish I knew before, to avoid issues with edge cases.

application(_:willFinishLaunchingWithOptions:)

--

--

Varga Zolt
Geek Culture

 Mobile Tech Lead📱 🧑‍💻 Writing about new Technologies. Coding for fun since 2005, for food since 2008 🚀 Site: https://bit.ly/skyspiritlabs