Apple has a really great curriculum on the Book Store called App Development with Swift: https://books.apple.com/book/app-development-with-swift/id1465002990
I highly recommend it... it's a great way to learn the fundamentals and build some projects along the way.
Post
Replies
Boosts
Views
Activity
You can use the Swift Playgrounds Author Template for Xcode, which you can download from here:
https://developer.apple.com/download/more/?=Swift%20Playgrounds%20Author
There's also a session at this year's WWDC to tell you more (and maybe show off a new way to do it?):
https://developer.apple.com/wwdc20/10654
I just ran an online class for kids where we took the Lights, Camera, Code playgrounds (after having gone through the Everyone Can Code Puzzles book -- https://books.apple.com/us/book/everyone-can-code-puzzles/id1481279769 -- with the kids) and used their infrastructure to build apps. They were getting ready to submit something for the Swift Student Challenge (but were a bit too young... you needed to be 16+ in Europe to submit.).
It's a great starting point once you've done the Learn to Code playgrounds!
You can use the Swift Playgrounds Author Template for Xcode, which you can download from here:
https://developer.apple.com/download/more/?=Swift%20Playgrounds%20Author
You'd use this, on your Mac, to create a playground book that you can distribute and run on iPads in Swift Playgrounds.
There's also a session at this year's WWDC to tell you more (and maybe show off a new way to do it?):
https://developer.apple.com/wwdc20/10654
Try now, it seems to have been uploaded!
This startLoad function isn't defined in the context of a class or struct, which is what self would refer to.
You could create a class called MyLoader or something, define the function on the type and then create an instance of the type and call the startLoad function on it...
Based on that code above you'll also need a webView property on your MyLoader class, as well as a handleServerError and handleServerError method defined.
To make it easier I created a playground feed you can subscribe to in Swift Playgrounds to add the first chapter to your iPad: https://developer.apple.com/ul/sp0?url=https://www.thecodehub.ie/playgrounds/wwdcfeed.json
This is just temporary until Apple finds it a permanent home...
For sure this is a deep(ish) end to jump into!
The absolute best place to start, in my mind, is with the free Everyone Can Code Puzzles book from Apple: https://books.apple.com/us/book/everyone-can-code-puzzles/id1481279769
I ran an online course for the last little while that I can't link in the forums, but it's up on YouTube as The Code Hub Everyone Can Code Puzzles. I walked through the material (it was aimed at kids ages 8-18 in Ireland, but a lot of their parents and folks outside Ireland followed along, too) in the book and in Swift Playgrounds. We just did a session on Swan's Quest, Chapter 1, and the background of Everyone Can Code Puzzles certainly helped them.
You don't need to edit any code in the shared code files (like Graphic.swift and all), just in the main swift file that you see when you navigate to the page. Like you mentioned, you just need to set the accessibilityLabel property on each of those torches to turn them all on.
I hope this helps!
I also chucked these playgrounds up in a temporary feed you can subscribe to: https://developer.apple.com/ul/sp0?url=https://www.thecodehub.ie/playgrounds/wwdcfeed.json
But the Files uncompressed tip works well, too!
To *not* have your Playgrounds sync (on your iPad) you can go to Settings and your iCloud account at the top of the settings list. In there, if you tap on the iCloud option you should see a list of app using iCloud... you can toggle the switch for Playgrounds and you should be good to go.
On the Mac, go to System Preferences and tap on the Apple ID preference in the top row. In the list of apps using iCloud on this Mac you should see an iCloud Drive row with an Options... button. Click on the Options button, find Playgrounds in the list that pops up, and uncheck it. That *should* do what you want...
With Playground Books you can author more involved experiences... chapters, pages... I use them to teach kids how to code or to guide them through a particular concept. Same with the Learn to Code playground books, they're brilliant examples of using a series of lessons to teach kids a certain set of concepts.
But if you're writing code to ultimately live in a project in Xcode I think you're good with just the plain old playground...
That's a great question!
Looking at your code it should work, but, for some reason that last tile with the stone blocking the path forward doesn't think it's being blocked forward, to the left or to the right.
(Try your code with an extra:
if isBlocked {
collectGem()
}
if isBlockedLeft {
collectGem()
}
if isBlockedRight {
collectGem()
}
for the craic and you'll see that Byte jumps to collect gems in lots of other places, but not on that last tile until Byte turns.)
In the hints they mention that there's a certain pattern to when you turn left and when you turn right... and in the solution, from the teacher's guide, the while loop is working until we see that Byte isOnOpenSwitch.
But you're right, I think your algorithm should work, but I'd need to do some more digging to see why it's not...
I hope that helps!
(The teacher's guide for all the solutions, even for comparing against your own solutions, is available here: https://education-static.apple.com/teaching-code/learn-to-code-solutions.pdf)
I gave an answer to this version of the question, here: https://developer.apple.com/forums/thread/658024
The text when you complete the Moving Further Forward page in Learn to Code 2 is trying to say that, now that you've learned about using parameters in your functions (like being able to specify how many steps forward you want Expert to take), you can use the move(distance:) function on any character. Like you folks were saying above, Expert and Character derive from the same base class, which, if you look into the sources for the playground (on your iPad, in the '...' menu under Advanced > View Auxilliary Source Files) you'll see that the Actor.swift file in the Book.playgroundmodule has a method defined called public func move(distance: Int)
This means that, even before you learned about this method by writing a function with the parameter for distance, there was a method you could call on your expert that would look like this:
expert.move(distance: 3)
It didn't show up in the autocompletions until the next page, but it was always there.
Does that make sense?
It depends if there is an Apple authorized training center near you, but you can get a certification from one of those in the Develop with Swift curriculum:
The Develop in Swift curriculum has been completely redesigned to help students explore app development on a Mac — and code just like the pros, for a semester or for certification. The curriculum is now accompanied by a free online professional learning course to help more educators give students an opportunity to make an impact with code.
(from this page, the Spotlight at the bottom: https://www.apple.com/education/k12/)