This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public struct BaseConverter | |
{ | |
static let alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // 62 digits | |
static func representNumber(n: Int, asciiAlphabet: String) -> String | |
{ | |
let base = asciiAlphabet.lengthOfBytes(using: String.Encoding.utf8) | |
if (n < base){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import UserNotifications; | |
extension NotificationManager: UNUserNotificationCenterDelegate | |
{ | |
// Called because the user interacted with a notification. Actions may be dismiss, open, or choosing an action. | |
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: () -> Void) | |
{ | |
print(response) | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) | |
{ | |
let token = deviceToken.description.components(separatedBy: CharacterSet(charactersIn: "<> ")).joined(separator: "" | |
dlog(token, .Info) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NotificationViewController: UIViewController, UINotificationContentExtension | |
{ | |
override func canBecomeFirstResponder() -> Bool { | |
return true | |
} | |
override var inputAccessoryView: UIView { | |
get { return inputView } | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NotificationViewController: UIViewController, UINotificationContentExtension | |
{ | |
func didReceive(_ response: UNNotificationResponse, | |
completionHandler done: (UNNotificationContentExtensionResponseOption) -> Void) | |
{ | |
server.postEventResponse(response.actionIdentifier) | |
{ | |
if response.actionIdentifier == "accept" | |
{ | |
eventResponse.text = "Going!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import UserNotifications | |
import UserNotificationsUI | |
struct Attachments { | |
static let image = (identifier:"image", jsonElement:"imageURL") | |
} | |
class ContentViewController: UIViewController, UNNotificationContentExtension | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() | |
{ | |
super.viewDidLoad() | |
let size = view.bounds.size | |
preferrredContentSize = CGSize(width: size.width, height: size.width / 2) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSExtension Dictionary | |
NSExtensionAttributes Dictionary | |
UNNotificationExtensionDefaultContent Number 0.5 | |
UNNotificationExtensionDefaultContentHidden Bool YES | |
UNNotificationExtensionCategory String event-invite | |
NSExtensionMainStoryboard String MainInterface | |
NSExtensionPointIdentifier String com.apple.usernotifications.content-extensio |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UserNotifications | |
class ServiceExtension: UNNotificationServiceExtension | |
{ | |
struct Attachments { | |
static let image = (identifier:"image", jsonElement:"imageURL") | |
} | |
var contentHandler: ((UNNotificationContent) -> Void)? | |
var content: UNMutableNotificationContent? |