Getting the text information from a touchNode

I am stuck on a problem and I didn’t know where else to turn so I decided to try it here. I am working on a game app where letters appear all over the SpriteKit screen and right now when you touch the screen the letters disappear. Now, I set up a node called touchedNode which is of type SKNode() and when I run it I get this information each time I touch a letter.

Optional( name:‘letters’ text:‘E’ fontName:‘Futura’ position:{418, 273})
Optional( name:‘letters’ text:‘D’ fontName:‘Futura’ position:{245, 158})
Optional( name:‘letters’ text:‘A’ fontName:‘Futura’ position:{498, 205})
Optional( name:‘letters’ text:‘D’ fontName:‘Futura’ position:{259, 170})

I feel there should be an easy way to get the text information from the touchedNode. I can get the name, touchedNode.name will give me Optional(“letters”) but if I say touchedNode.text there’s an error because SKNode() doesn’t have text. That said, how do I get the text information from the touchedNode and get rid of the Optional part as well?

Could you not use a SKLabelNode? That has .text, and it is a SKNode.

I did try that but SKLabelNode won’t take a “nodeAtPoint(touchLocation)” which I needed touchedLocation to do.

The solution, as I just figured out, was surprisingly simple…

I had to set the SKLabelNode’s text to a unique letter, and then, since SKNode allows you to access the NAME, I set the NAME to the same LETTER, and thus accesing SKNode.name solves my problem of accessing SKNode.text (which doesn’t exit)

Now, one more problem arises when you do it this way and that is when you touch anywhere else on the screen, being an optional, SKNode returns null for the NAME. Simply adding an “if let” statements solves this problem, again, easily.

It is working, and it prevents me from literally creating an SKLabelNode for every letter in the alphabet which I was nearly having to do. I hope this almost makes sense, it was hard to describe and this is my very first game I am developing on my own