What part of the Stack Overflow answer didn't work? What did you try that didn't work?. If you look at the SKScene class documentation in Xcode, there's an init function to create a scene in code without using a .sks file.
Topic:
Graphics & Games
SubTopic:
SpriteKit
Tags: