0

I have a project that I want to add sirikit to. I added the intent and wanted to store values in my datastorage which is realm, when I tried to access the function that is used to create this task , I get an eeror. this is my code below

extension IntentHandler : INCreateTaskListIntentHandling {

    public func handle(intent: INCreateTaskListIntent,
                       completion: @escaping (INCreateTaskListIntentResponse) -> Swift.Void) {

        guard let title = intent.title else {
            completion(INCreateTaskListIntentResponse(code: .failure, userActivity: nil))
            return
        }



        CategoryFunctions.instance.createList(name: title.spokenPhrase,.....)

        var tasks: [INTask] = []
        if let taskTitles = intent.taskTitles {
            let taskTitlesStrings = taskTitles.map {
                taskTitle -> String in
                return taskTitle.spokenPhrase
            }
            tasks = createTasks(fromTitles: taskTitlesStrings)
            CategoryFunctions.instance.add(tasks: taskTitlesStrings, toList: title.spokenPhrase)
        }

        let response = INCreateTaskListIntentResponse(code: .success, userActivity: nil)
        response.createdTaskList = INTaskList(title: title,
                                              tasks: tasks,
                                              groupName: nil,
                                              createdDateComponents: nil,
                                              modifiedDateComponents: nil,
                                              identifier: nil)
        completion(response)
    }

}

this singlton instantiation works well in my app but I do not know why I get an error saying Use of unresolved identifier 'CategoryFunctions'

my CategoryFunctions singleton

class CategoryFunctions {

    let appDelegate = UIApplication.shared.delegate as! AppDelegate

    var database:Realm!
    static let instance = CategoryFunctions()
    .....
...
King
  • 1,885
  • 3
  • 27
  • 84
  • https://forum.realm.io/t/synced-realm-app-extension/1026/5 ,,,,,, https://academy.realm.io/posts/tutorial-sharing-data-between-watchkit-and-your-app/ – Shehata Gamal Oct 20 '18 at 15:25
  • is it not possible to add the `CategoryFunctions` or any other class into the extention? – King Oct 20 '18 at 15:26

1 Answers1

0

Select your file in xcode, on the right, choose the File Inspector, then under Target Membership, pick your Intent.

Phuah Yee Keat
  • 1,572
  • 1
  • 17
  • 17