Commit aaff608d authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Use FlutterAppDelegate in iOS create template (#7845)

On iOS, generate a FlutterAppDelegate subclass for the application
delegate. This avoids touchesBegan:withEvent boilerplate to handle
status bar taps.
parent 484067ed
#import <UIKit/UIKit.h>
#import <Flutter/Flutter.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@interface AppDelegate : FlutterAppDelegate
@end
#import <Flutter/Flutter.h>
#include "AppDelegate.h"
@implementation AppDelegate
......@@ -30,16 +29,4 @@
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
// Support scroll to top on status bar tap. By default, pass status bar taps
// to the application's root view controller for handling in Flutter.
UIViewController *viewController =
[UIApplication sharedApplication].keyWindow.rootViewController;
if ([viewController isKindOfClass:[FlutterViewController class]]) {
[(FlutterViewController*)viewController handleStatusBarTouches:event];
}
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment