Adding SKNodes to a ScrollView within a SKScene?

Is there seriously no way to add SKNodes (e.g. sprites) into a ScrollView?

On Android, I've previously used CCScrollView (part of Cocos2D-X) but Xcode seems to be lacking anyway to easily create a scrollable container for SKNodes, with the extras a ScrollView brings (like the elastic bounce, scrollbars, swipe gestures, etc).

I know there's UIScrollView, but I'm writing for macOS. And there's SKCameraNode, but this seems to target the whole scene.

I'm just like to create a horizontal scrollable node containing lots of interactive sprites within a scene.

I know I could simply make the node move in relation to the mouse x value, but that's not good as a scrollview.

Thanks

Hello,

You can embed a SpriteKit view inside of a ScrollView, for example:

ScrollView {
      SpriteView(scene: scene)
           .frame(width: scene.frame.width, height: scene.frame.height)
}

However, there are significant performance considerations when you do something like this. For example, SpriteKit will be forced to render the entire scene (even the non-visible portions), and it will also allocate a drawable large enough to draw that entire scene. Depending on how large the scene's frame is, this may quickly become a performance bottleneck or consume a very large amount of memory. This is why I would recommend that you utilize SKCameraNode and implement scrolling functionality yourself (by moving/animating the camera position based on gestures), that way you do not encounter these performance issues!

Adding SKNodes to a ScrollView within a SKScene?
 
 
Q