How to Save a Score in SpriteKit(Swift 5)

How would I save a score in SpriteKit using NSUserDefaults. Also, how would I use this for a high score?

I am making a Flappy Bird Clone and need to be able to save scores and have a high score.

I am also new to Spritekit, and my score variable is "score". I have made a key called xpkey. I have a highscore variable and a highscorelabel variable.

Any help is appreciated.

How to Save a Score in SpriteKit(Swift 5)
 
 
Q