Import Uikit@uiapplicationmainclassAppdelegate:uiresponder, uiapplicationdelegate {var window:uiwindow?func Application (application:uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject:anyobject]< /c3>?) -Bool {Self.window=UIWindow (Frame:UIScreen.mainScreen (). Bounds)//Override point for customization after application launch.self.window!. BackgroundColor =Uicolor.whitecolor () Self.window!. Rootviewcontroller =Rootviewcontroller () Self.window!. makekeyandvisible ()return true }}
Import UIKitclassRootviewcontroller:uiviewcontroller {Overridefunc viewdidload () {super.viewdidload ()//Call the ProcessData functionProcessData {(), ()inchPrint ("It's been recalled."); }} func ProcessData (printsomething: ()-()) {print ("Perform Actions"); //Execute closure Callbackprintsomething (); }}
Simple use of SWIFT closures