I was trying to initiate an integer value in UserDefaults. But I want to do this operation once. At the first launch.
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UserDefaults.standard.set(-1, forKey: Constant.shared.empId)
return true
}
I tried this the above way. But didFinishLaunchingWithOptions is calling every time I launch the app. is there any function that is called once during the app's whole life cycle?