forked from burczyk/XcodeSwiftSnippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swift-uiremotenotification.codesnippet
49 lines (41 loc) · 2.02 KB
/
swift-uiremotenotification.codesnippet
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDECodeSnippetCompletionPrefix</key>
<string>swift-uiremotenotification</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>ClassImplementation</string>
</array>
<key>IDECodeSnippetContents</key>
<string> //MARK: Remote Notifications
// Move this line somewhere where your app starts
// UIApplication.shared.registerForRemoteNotifications()
// Ask user for allowed notification types
// let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
// UIApplication.shared.registerUserNotificationSettings(settings)
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
print("Successfully egistered for Remote Notifications with token: \(deviceToken)")
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
print("Registration for Remote Notifications failed with error: \(error)")
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
}
public func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
}</string>
<key>IDECodeSnippetIdentifier</key>
<string>0ADC5D4B-64A3-42B1-8A4D-5741D99D0714</string>
<key>IDECodeSnippetLanguage</key>
<string>Xcode.SourceCodeLanguage.Swift</string>
<key>IDECodeSnippetSummary</key>
<string>UIRemoteNotification registration and handling snippet for Swift</string>
<key>IDECodeSnippetTitle</key>
<string>Swift UIRemoteNotification</string>
<key>IDECodeSnippetUserSnippet</key>
<true/>
<key>IDECodeSnippetVersion</key>
<integer>2</integer>
</dict>
</plist>