Having trouble with NSSpellChecker properly and setting words to ignore

This question shows research effort; it is useful and clear 0

I'm trying to implement a function to check the names of some subfolders for spelling. I have a test function, shown below. The folder names are in a [String] called listOfFolders.

I'm using guesses(forWordRange:in:language:inSpellDocumentWithTag:) and it seems to work in that it does show me recommended spellings of words that seem to be spelled incorrectly, however I want to ignore some words – and that doesn't seem to work.

func check() {
        let words = listOfFolders.joined(separator: " ")
        let spellChecker = NSSpellChecker.shared
        spellChecker.setIgnoredWords(["Stills", "Video", "HEIC", "JPG", "EIP", "ARW", "IIQ", "NEF", "FFF", "CR2", "CR3", "RAF", "DNG"], inSpellDocumentWithTag: 0)
        for word in listOfFolders {
            let w = word
            let start = 0
            let end = w.count
            let range : NSRange = NSRange(location: start, length: end)
            let g = spellChecker.guesses(forWordRange: NSRange.init(location: start, length: end), in: String(w), language: nil, inSpellDocumentWithTag: 0)
            print("w: \(w)")
            print("g: \(g)")
        }
    }
Having trouble with NSSpellChecker properly and setting words to ignore
 
 
Q