-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathSetupKeyboardObserverOnAppStartup.m
More file actions
66 lines (50 loc) · 1.71 KB
/
SetupKeyboardObserverOnAppStartup.m
File metadata and controls
66 lines (50 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// SetupKeyboardObserverOnAppStartup.m
// ListableUI
//
// Created by Kyle Van Essen on 8/24/20.
//
@import Foundation;
@import UIKit;
#if __has_include (<ListableUI/ListableUI-Swift.h>)
#import <ListableUI/ListableUI-Swift.h>
#elif __has_include ("ListableUI-Swift.h")
#import "ListableUI-Swift.h"
#endif
@interface __LST_SetupKeyboardObserverOnAppStartup : NSObject
@end
@implementation __LST_SetupKeyboardObserverOnAppStartup
/// Register for `applicationDidFinishLaunching`, so we can set up
/// our keyboard observer to always know when the keyboard is visible.
/// Yes, I know, and I am sorry.
+ (void)load {
if (self != __LST_SetupKeyboardObserverOnAppStartup.class) {
return;
}
[self sharedInstance];
}
+ (instancetype)sharedInstance;
{
static __LST_SetupKeyboardObserverOnAppStartup *loader = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
loader = [[__LST_SetupKeyboardObserverOnAppStartup alloc] init];
});
return loader;
}
- (instancetype)init;
{
self = [super init];
NSParameterAssert(self);
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(applicationDidFinishLaunchingNotification)
name:UIApplicationDidFinishLaunchingNotification
object:nil];
return self;
}
- (void)applicationDidFinishLaunchingNotification NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.");
{
/// Application has now finished launching, so set up the keyboard
[ListView configureWithApplication:UIApplication.sharedApplication];
}
@end