Skip to content

Commit

Permalink
Added Category Action buttons support
Browse files Browse the repository at this point in the history
  • Loading branch information
d7laungani committed Dec 25, 2016
1 parent 2fd4184 commit 5c095ae
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions DLLocalNotifications/DLLocalNotifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,24 @@ public class DLNotificationScheduler{
}


func scheduleCategories(categories:[DLCategory]) {

var categories1 = Set<UNNotificationCategory>()

for x in categories {

categories1.insert(x.categoryInstance!)
}
UNUserNotificationCenter.current().setNotificationCategories(categories1)



}





}

// Repeating Interval Times
Expand All @@ -150,6 +168,37 @@ enum Repeats: String {
}


// A wrapper class for creating a Category

public class DLCategory {

private var actions:[UNNotificationAction]?
internal var categoryInstance:UNNotificationCategory?
var identifier:String


init (categoryIdentifier:String) {

identifier = categoryIdentifier

}

func addActionButton(identifier:String?, title:String?) {

let action = UNNotificationAction(identifier: identifier!, title: title!, options: [])
actions?.append(action)
categoryInstance = UNNotificationCategory(identifier: self.identifier, actions: self.actions!, intentIdentifiers: [], options: [])

}





}




// A wrapper class for creating a User Notification

Expand Down

0 comments on commit 5c095ae

Please sign in to comment.