 
 }
 
+protocol ShortcutType: RawRepresentable {}
+
+extension RawRepresentable where Self: ShortcutType {
+
+    init?(type: String) {
+        assert(type is RawValue)
+        // FIXME: try another solution to restrain the RawRepresentable as String
+        self.init(rawValue: type as! RawValue)
+    }
+
+    var value: String {
+        return self.rawValue as? String ?? ""
+    }
+
+}
+
 struct Shortcut {
 
-    let id: String
+    let type: String
     let title: String
     let subtitle: String?
     let icon: ShortcutIcon?
 
-    init(id: String, title: String, subtitle: String?, icon: ShortcutIcon) {
-        self.id = id
+    init<T: ShortcutType>(type: T, title: String, subtitle: String?, icon: ShortcutIcon) {
+        self.type = type.value
         self.title = title
         self.subtitle = subtitle
         self.icon = icon

protocol QuickActionSupport {

    @available(iOS 9.0, *)
    func prepareForQuickAction(shortcut: Shortcut)

}

class QuickActions {

    let bundleIdentifier: String


    @available(iOS 9.0, *)
    init(shortcutItem: UIApplicationShortcutItem) {
        if let range = shortcutItem.type.rangeOfCharacterFromSet(NSCharacterSet(charactersInString: "."), options: .BackwardsSearch) {
            type = shortcutItem.type.substringFromIndex(range.endIndex)
        }
        else {
            type = "unknown"
        }
        title = shortcutItem.localizedTitle
        subtitle = shortcutItem.localizedSubtitle
