From bf47e5ee9987eef37cd7b2f3a7586c8d13da838a Mon Sep 17 00:00:00 2001 From: scawful Date: Fri, 2 Aug 2024 15:34:06 -0400 Subject: [PATCH] add iOS AppDelegate interface to app_delegate.h --- src/app/core/platform/app_delegate.h | 23 ++++++++++++++++++++++- src/app/core/platform/app_delegate.mm | 5 +---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/app/core/platform/app_delegate.h b/src/app/core/platform/app_delegate.h index aab3df42..72ec4200 100644 --- a/src/app/core/platform/app_delegate.h +++ b/src/app/core/platform/app_delegate.h @@ -1,7 +1,26 @@ #ifndef YAZE_APP_CORE_PLATFORM_APP_DELEGATE_H #define YAZE_APP_CORE_PLATFORM_APP_DELEGATE_H -#ifdef TARGET_OS_MAC +#if defined(__APPLE__) && defined(__MACH__) +/* Apple OSX and iOS (Darwin). */ +#import +#include + +#if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1 +/* iOS in Xcode simulator */ +#import + +@interface AppDelegate : UIResponder +@property (strong, nonatomic) UIWindow *window; + +@property UIDocumentPickerViewController *documentPicker; +@property (nonatomic, copy) void (^completionHandler)(NSString *selectedFile); + +- (void)presentDocumentPickerWithCompletionHandler:(void (^)(NSString *selectedFile))completionHandler; + +@end + +#elif TARGET_OS_MAC == 1 #ifdef __cplusplus extern "C" { @@ -15,4 +34,6 @@ void InitializeCocoa(); #endif // TARGET_OS_MAC +#endif // defined(__APPLE__) && defined(__MACH__) + #endif // YAZE_APP_CORE_PLATFORM_APP_DELEGATE_H diff --git a/src/app/core/platform/app_delegate.mm b/src/app/core/platform/app_delegate.mm index 141df9e8..3609bd4b 100644 --- a/src/app/core/platform/app_delegate.mm +++ b/src/app/core/platform/app_delegate.mm @@ -11,12 +11,9 @@ #import -#if TARGET_IPHONE_SIMULATOR == 1 +#if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1 /* iOS in Xcode simulator */ -#elif TARGET_OS_IPHONE == 1 -/* iOS */ - #elif TARGET_OS_MAC == 1 /* macOS */ #import