I have the following code. When it runs, it triggers the error : Cannot subscript a value of type '[String : Int]' with an index of type 'String?'
Can someone please help
self.books = self.books.filter { $0.completed[MUser.sharedInstance.getUserId()] ?? 0 > 0 }
completed is declared as
var completed = [String : Int]()
    
getUserId()is obviously an optional. The error says the key must be non-optional. Basically it's the same issue as in your previous question.