How to ignore default action from NSEvent

I have an app that has field delimiters in a textField and I have a function that can go to next field or go to previous field. It works as expected when called as a function but I want to assign the Tab and Shift tab to functions as well. I added some logic to only process the function if the window with the field delimiters is open. It works however it also inserts a Tab character in the document which I don't want. I want to override the default Tab insertion with my function similar to how it working in JS with preventDefault. Here is the tab key check code;

        if  (keyPressedBitwise == tabKeyBW) && (editorWindowOpen == true) {
            if !event.isARepeat {
                print("***NOT A REPEAT, LETS FIRE IT OFF***")
                if event.type.rawValue == 10 {
                    print("Sending next field command")
                    sendNextFieldKey()
                }
            }
            return
        }

I use this code in other places but they keys are assigned to non-character keys ie: F3, Ctrl+Home etc... and I don't seem to have an issue anywhere else. My thought is maybe the Tab character is getting inserted into the document before it hits my code. If I have to I can assign a non-character code to the next and previous field function but would prefer to use the Tab and Shift tab as they are familiar. Any suggestions are appreciated.

How to ignore default action from NSEvent
 
 
Q