ios - Is there a function in Swift that only runs during the first time opening the app? -


i'm making dictionary app , i'm re-parsing through json file contains entries of dictionaries every time open app , saving coredata. wondering if there function in swift runs once when app downloaded , doesn't run again.

what can set nsuserdefaults check whether firstrun or not

here code

let firstrun = nsuserdefaults.standarduserdefaults().boolforkey("firstrun") bool         if !firstrun {             //run function             nsuserdefaults.standarduserdefaults().setbool(true, forkey: "firstrun")         } 

Comments