简体   繁体   中英

How to call an AppDelegate method from a UIViewController

In my appDelegate.m file I have this method

- (void) goToRN {
   [RCTKeyWindow().rootViewController dismissViewControllerAnimated:true completion:nil];
}

and I would like to call this method from my ConsentViewController.swift file like: AppDelegate().goToRN()

but I'm getting this error: Value of type 'AppDelegate' has no member 'goToRN'

You can get it from the application global variable:

NSApp.delegate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM