Post

Replies

Boosts

Views

Activity

Best way to navigate multiple game screens
Good morning everyone, I'm building a simple game (my first game) using SwiftUI and SpriteKit that contains multiple views. I'm writing my game based on a main scene loaded into the GameView using a SpriteView. From there, using buttons, I move from one scene to another using self.scene?.view?.presentScene(...) and also with some cool transitions (.crossFade(withDuration: 0.5))). But I'm not sure if this is the best approach. I would need some guidance because I cannot find any material discussing the best way to create a proper navigation with SpriteKit. Do you have an updated article, tutorial, or reference that I can follow to learn about the best way to implement navigation in a SpriteKit game? What I'm doing right now is working, but I have limitations, for example, if I want to mix SwiftUI views and SpriteKit scenes. I want to add a Credits scene with some text and images that I want to do in SwiftUI and a Statistic scene with some cool graphics to show the players, but I don't know if I can navigate from an SKScene into a View, or if I need a completely different approach. Can I add UI components directly in a SpriteKit scene instead of using a different navigation system and full SwiftUI views? I really appreciate any help you can provide. As you can see, I'm a little bit lost 😅 Thanks a lot in advance 🙏
0
1
407
Aug ’24
Why "let/var" and not "const/var" in Swift?
Hi there! Out of curiosity. Why not use const and var instead of let and var in Swift? I'm intrigued because it seems easier to understand var as variable and const as constant. I'm a JavaScript developer, and I never understood choosing let as the new var, but in Swift, choosing let as the new const... well, it's a little bit confusing. Is there a genuine reason for this decision, or was it to avoid colliding with JavaScript? Thanks a lot in advance for your answers 🙂
2
0
2k
Dec ’21