Post

Replies

Boosts

Views

Activity

Reply to Combining SwiftUI & SpriteKit
Show the code you use to declare the property for the scene in the SwiftUI view Here it is: private var mainCamera: SKCameraNode? class func newGameScene() -> SKScene { if let scene = SKScene(fileNamed: "MapScene") { // Set the scale mode to scale to fit the window scene.scaleMode = .aspectFill // Present the scene return scene } else { abort() } } } What are you trying to do? I'm trying to access to interact with my scene from a .sks file. By interact, I mean writing code to interact with the scene, like we do when we have a SpriteKit project. What do you expect to happen? I can program my scene. What happens? I can see my scene in the built project, but I can't program it. But even if you couldn't help me, at least you tried. So thank you ❤️
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’23
Reply to Combining SwiftUI & SpriteKit
The code I gave you is a little wrong because I wrote it on the go, sorry about that. So, the code from the project: //imports... struct MapView: View { var body: some View { ZStack { SpriteView(scene:MapScene()) } } } class MapScene: SKScene { class func newGameScene() -> MapScene { guard let scene = SKScene(fileNamed: "MapScene") as? MapScene else { print("Failed to load GameScene.sks") abort() } scene.scaleMode = .aspectFill return scene } } Changes applied, but it still shows a black screen.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’23
Reply to Combining SwiftUI & SpriteKit
Show the code you use to declare the property for the scene in the SwiftUI view Here it is: private var mainCamera: SKCameraNode? class func newGameScene() -> SKScene { if let scene = SKScene(fileNamed: "MapScene") { // Set the scale mode to scale to fit the window scene.scaleMode = .aspectFill // Present the scene return scene } else { abort() } } } What are you trying to do? I'm trying to access to interact with my scene from a .sks file. By interact, I mean writing code to interact with the scene, like we do when we have a SpriteKit project. What do you expect to happen? I can program my scene. What happens? I can see my scene in the built project, but I can't program it. But even if you couldn't help me, at least you tried. So thank you ❤️
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Combining SwiftUI & SpriteKit
It works with some changes. But I still can't interact with the MapScene because the SpriteView now calls the newGameScene function rather than the MapScene class.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Combining SwiftUI & SpriteKit
The code I gave you is a little wrong because I wrote it on the go, sorry about that. So, the code from the project: //imports... struct MapView: View { var body: some View { ZStack { SpriteView(scene:MapScene()) } } } class MapScene: SKScene { class func newGameScene() -> MapScene { guard let scene = SKScene(fileNamed: "MapScene") as? MapScene else { print("Failed to load GameScene.sks") abort() } scene.scaleMode = .aspectFill return scene } } Changes applied, but it still shows a black screen.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Apple Script: posix alias to posix file
It works, Thanks!
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to How to get an incoming file in Apple Script
Oh, Thanks!
Replies
Boosts
Views
Activity
May ’22
Reply to How to get an incoming file in Apple Script
This application written on AppleScript using Script Editor
Replies
Boosts
Views
Activity
May ’22
Reply to How to get an incoming file in Apple Script
I have a application
Replies
Boosts
Views
Activity
May ’22