Post

Replies

Boosts

Views

Activity

Reply to How to add a .sks file to a playground?
It's possible! I did it in mine. You'll have to add your .sks in the PrivateResourses folder and you'll have to call it in ChaptersChapter1 (or inside the chapter you want)PagesPlaygroundPage1(or inside the page you want)main: swift /*:  Text  Text!  */ //#-hidden-code import PlaygroundSupport import SpriteKit import BookCore // Load the SKScene from 'GameScene.sks' let sceneView = SKView(frame: CGRect(x:0 , y:0, width: 683, height: 1024)) // I called my .sks controller Main1 and the fileNamed is the name of .sks if let scene = Main1(fileNamed: "Main1") {     // Set the scale mode     scene.scaleMode = .aspectFit     // Present the scene     sceneView.presentScene(scene) } PlaygroundSupport.PlaygroundPage.current.liveView = sceneView //#-end-hidden-code Hope it helps!
Apr ’21
Reply to How to transition from a SwiftUI Page to a SpriteKit Scene?
I don't know how you do this for playgrounds, but that's how you integrate spritekit with swiftUI, you use a spriteView: swift // A simple game scene with falling boxes class GameScene: SKScene { override func didMove(to view: SKView) { physicsBody = SKPhysicsBody(edgeLoopFrom: frame) } override func touchesBegan(_ touches: SetUITouch, with event: UIEvent?) { guard let touch = touches.first else { return } let location = touch.location(in: self) let box = SKSpriteNode(color: SKColor.red, size: CGSize(width: 50, height: 50)) box.position = location box.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: 50, height: 50)) addChild(box) } } // A sample SwiftUI creating a GameScene and sizing it // at 300x400 points struct ContentView: View { var scene: SKScene { let scene = GameScene() scene.size = CGSize(width: 300, height: 400) scene.scaleMode = .fill return scene } var body: some View { SpriteView(scene: scene) .frame(width: 300, height: 400) .ignoresSafeArea() } } Hope it helps :)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to How can I make two SKActions run at the same time?
I solved using group: swift let zoomInAction = SKAction.scale(to: 0.2, duration: 3)  let moving = SKAction.move(to: CGPoint(x: -255, y: 15), duration: 3)        let group = SKAction.group([moving,zoomInAction])        cam.run(group)
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Replies
Boosts
Views
Activity
Apr ’21
Reply to Enabling Results in Swift Playgrounds causes app to crash
I agree with @aminouled, I already had this problem and I solved It writing a note on the book part of the playground asking the jugdes to Disable Results before running
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’21
Reply to How to add a .sks file to a playground?
It's possible! I did it in mine. You'll have to add your .sks in the PrivateResourses folder and you'll have to call it in ChaptersChapter1 (or inside the chapter you want)PagesPlaygroundPage1(or inside the page you want)main: swift /*:  Text  Text!  */ //#-hidden-code import PlaygroundSupport import SpriteKit import BookCore // Load the SKScene from 'GameScene.sks' let sceneView = SKView(frame: CGRect(x:0 , y:0, width: 683, height: 1024)) // I called my .sks controller Main1 and the fileNamed is the name of .sks if let scene = Main1(fileNamed: "Main1") {     // Set the scale mode     scene.scaleMode = .aspectFit     // Present the scene     sceneView.presentScene(scene) } PlaygroundSupport.PlaygroundPage.current.liveView = sceneView //#-end-hidden-code Hope it helps!
Replies
Boosts
Views
Activity
Apr ’21
Reply to Can I apply enrolled as company?
I think you need to create a new one and apply from that, but remember that you don't need to have a payed account!
Replies
Boosts
Views
Activity
Apr ’21
Reply to How to transition from a SwiftUI Page to a SpriteKit Scene?
I don't know how you do this for playgrounds, but that's how you integrate spritekit with swiftUI, you use a spriteView: swift // A simple game scene with falling boxes class GameScene: SKScene { override func didMove(to view: SKView) { physicsBody = SKPhysicsBody(edgeLoopFrom: frame) } override func touchesBegan(_ touches: SetUITouch, with event: UIEvent?) { guard let touch = touches.first else { return } let location = touch.location(in: self) let box = SKSpriteNode(color: SKColor.red, size: CGSize(width: 50, height: 50)) box.position = location box.physicsBody = SKPhysicsBody(rectangleOf: CGSize(width: 50, height: 50)) addChild(box) } } // A sample SwiftUI creating a GameScene and sizing it // at 300x400 points struct ContentView: View { var scene: SKScene { let scene = GameScene() scene.size = CGSize(width: 300, height: 400) scene.scaleMode = .fill return scene } var body: some View { SpriteView(scene: scene) .frame(width: 300, height: 400) .ignoresSafeArea() } } Hope it helps :)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’21
Reply to How to add another playground page
I'm not sure if I understand your problem, but I think that adding a new page or you duplicate existing pages should work. Anyway you can always take a playgroundbook template (from apple) and modify it.
Replies
Boosts
Views
Activity
Apr ’21
Reply to Submitting a Playground that works on both iPad and Mac… is that possible?
In the moment of applying, in the forms, you'll have to choose where you want de judges run you project. You can only select one, so I think you can't ask for using iPad and Mac. :(
Replies
Boosts
Views
Activity
Apr ’21
Reply to Submission format and type: .playground or .playgroundbook
You can create in the playgrounds app or in the Xcode, i would suggest in Xcode, because playground has more bugs. You can send it as a .playground or .playgroundbook, they're both accepted.
Replies
Boosts
Views
Activity
Apr ’21
Reply to Use Playground Author Template?
A lot of people use the author template, however it's more complicated to understand how it works. You can always use the regular swift playground template!
Replies
Boosts
Views
Activity
Apr ’21
Reply to Swift Playground show hidden-code and other tags, unable to open Playground
If you're using author's template, check it out a template that i made, where i used hidden code: https://github.com/dudamello/TemplateWWDC Hope it helps
Replies
Boosts
Views
Activity
Apr ’21
Reply to Network Connection for Swift Student Challenge
No! Everything you can use needs to be inside the zip file. No connection to the internet is allowed.
Replies
Boosts
Views
Activity
Apr ’21
Reply to Does Playground compile time count towards three-minute maximum?
I think it doesn't count, but we're never sure. I would try to make the hole experience quicker, if it's possible, and not leaving the best for the end.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’21
Reply to Swift Playgrounds - playground icons
You can only add icons in the playground if it's a .playgroundbook
Replies
Boosts
Views
Activity
Apr ’21
Reply to Xccode 12 game Fullscreen
Same problem! Selecting your project and under General-App icons and launch images-Launch Screen File = Main worked for me!
Replies
Boosts
Views
Activity
Apr ’21