We’ll have a lot of hands on with Keynote prototyping, as well as the next leap: to code!
As a part of our activity, I’ve thrown together a playground based on a prototype one of Lyndsey’s students did. The goal is to show you (or your students) how the user interface relates to code.
If you’re curious and want to get a sneak peek of some of what we’ll be working you through on Thursday, go ahead and download this playground to your iPad or Mac. It’s in the main Code Hub Playgrounds feed, which you can access here: https://www.thecodehub.ie/playgrounds/
If you already subscribe to the feed, this new playground will show up when you tap on More Playgrounds > See All. It should look a bit like this:
It’s called Europe Code Week 2021: App Inclusivity Playground, and there are plenty of instructions in the playground, itself. If you’re lost, though, you can always join us on Thursday. We’ll work through the App Inclusivity activity and how you might use it in your classroom.
The challenge is all about considering people from many different backgrounds with many different types of abilities when you design your apps.
The Activity & the Audience
This activity is perfect for teachers who might have an iPad 1-to-1 classroom or school, but you can adapt it, no matter the gear you have on hand.
It’s also perfect for you if you don’t have a background in coding. We spend a lot of the activity just thinking about what makes an app and how we might design it to accommodate all sorts of users.
Now, we will still touch on coding, of course, as it is EU Code Week, but hopefully we’ll do so in as non-threatening a way as possible. To do that, I’ll show you Swift Playgrounds and the really fun Answers playground.
This is a playground where students write code to get answers from their fellow students and can use those answers in their code later.
You’ll see how you can design your code and app at all sorts of levels.
For those who want to build out their creative vision, you’ll learn about Keynote prototypes and the power you can wield, putting your idea in people’s hands.
Our Adventures feed, for those of you just joining us, or who’ve forgotten, is aimed at slightly more advanced folks. It explores things like SwiftUI, UIKit in playgrounds, and more.
The PlaygroundBook: Animating Images
The new playground book is called Animating Images and shows you how to use some of the cool capabilities in UIImageView to display a series of images over a certain amount of time.
The first page is an implementation of animated images using UIImage and UIImageView. We pass an array of images to a static method on UIImage and set the duration over which they should be displayed. Play around with different numbers of images and duration to fine tune your animation. Make sure to read through the comments, which will show you other ways of using UIImageView.
The second page implements the same thing, but with SwiftUI. It cheats, a little bit. The Image view that you would use to display images in SwiftUI doesn’t animate UIImages that are animations. Try it out, instead of using our new AnimatedImage view, comment that line out and add this line:
You’ll see a very static image that only displays our first image from the array. Our AnimatedImage addition is simply a wrapper around UIKit’s UIImageView. We could have used Combine or some other clever way to update our view with images. But this approach simply takes advantage of a well-known component we can re-use without too much pain.
Try it out, play around with your own images, your own timing, and see what kind of animated image you can create!
You can subscribe to our Adventures feed (or the original feed) here https://www.thecodehub.ie/playgrounds/ from your iPad. Alternatively, if you use Playgrounds on a Mac, you can paste this URL into the subscription bar: https://www.thecodehub.ie/playgrounds/adventures/feed.json
We’re in the thick of a hackathon project and some students are plowing ahead with their prototypes and looking to turn them into full-blown apps.
In this new video I walk you through a pretty common scenario.
Many of our apps are going to have more than one screen. And what appears on subsequent screens is going to depend on what a person has tapped on or possibly something they’ve typed in or a way they’ve interacted with a previous screen.
So we need a way to pass data from one screen to the next. This topic is covered in Develop in Swift Fundamentals in Lesson 3.6, Segues and Navigation Controllers.
Our segue will be our go-between our original, or our source, view and our destination view. And there’s a little bit of sort of magic* involved.
Check out the video below for some steps through creating another View Controller that will be our destination view, the code that backs it, a connection to the new view, and how to wire up passing data between the two.
Best of luck building out your more complex app!
* Well, not quite “magic.” More like hooks into the very inner life of our iOS app like we’ve got a pair of X-ray specs and suddenly we can see all this cool underpinning of our apps going on that maybe we didn’t realize was there before.
One of my favorite things from WWDC21 this year was the DocC stuff. The funny thing is, I had NO IDEA it would be one of my favorites until Saturday, when I was catching up on some sessions.
There are the heavy hitters, of course, like the SwiftUI sessions, the announcement that you’ll be able to build and submit apps to the App Store from the next version of Swift Playgrounds. But this was a sneaky, wonderful surprise.
That’s a good start, building rich tutorials that show up in the Xcode documentation window. Buuuuuuut, if you check out Host and automate your DocC documentation, you’ll see that you can put it up on your own site!
You need Xcode 13, the beta, to build documentation, but your students don’t. You can export the DocC archive, put it up on a website, and away you go!
Now, it was a bit more work than just “upload it to a website and you’re good to go.” I’ll go into the details of what you need to do, from a practical standpoint, in the future.
Like I said, I’ll detail how I built that tutorial in a future post, but in the meantime you can see the results. It’s rare we get to ship stuff they just announce at WWDC, and ‘m so psyched about writing some more tutorials and having them look excellent out of the gate!
Happy WWDC! It’s that magical time of year when developers working on Apple platforms have all their dreams come true!
Well, okay, maybe not, but we get a very fun week of new tech and demos and excitement about the platform.
If you’re watching all of this (or watching the people watching it and wondering what the heck is all the fuss about), we’ll probably have some words about it this week. But before that all kicks off, I threw a little playground up for you to experiment with, especially if you’re new to Swift, Apple’s programming language for iPhone, iPad, Mac, Apple Watch, and AppleTV apps.
There’s a really fun exercise in Develop in Swift Explorations called QuestionBot. In it, you build the brains of an app to answer whatever question a person might type in. You can make it super complicated, or very, very simple.
Well, now, even if you don’t have a Mac, you can play around with QuestionBot. I created a REPL on replit.com with some simple instructions so that you, too, can create a functioning QuestionBot. Try it out:
There are two files, just tap on the Code tab and you’ll see main.swift and QuestionBot.swift.
Those show you the brains of our app.
If you want to edit the code, just tap on the Fork button, which will create a copy of the code. You need to create a free replit.com account or link it to your Google, Github, or Facebook account, if you have one.
If you want to change QuestionBot’s behavior: how it asks questions and how it answers them, look in the QuestionBot.swift file.
If you want to change something else about the program, maybe limit it to only allowing you to ask three questions, or only letting people ask it questions on a Thursday, you would edit the main.swift file.
Coding for All
I really like replit.com because you can use it with any device, and it’s a great way to get an introduction to Swift before jumping in with an iPad or Mac.
I’ll be recording a short video introducing the QuestionBot on replit.com in the near future, but in the meantime, good luck coding!
Inspired by some recent teacher questions via email and Twitter, I threw together some more advanced Swift Playgrounds.
Right now there are two of them. As Swift Playgrounds, they’re designed to run in the Playgrounds app on your iPad, so you can take your code on the go with you, or monkey around with them in the Playgrounds app on your Mac. Playgrounds is a great environment for tinkering with code and it just keeps getting better and better.
I split them into a separate feed from our normal playground feed because the original is aimed at beginners, learning to code. This new set of playgrounds comes with fewer instructions and tackles more complex material.
Add the feed from our playgrounds page, if you’re on an iPad. If you’re using Playgrounds on a Mac, you can select File > Add Subscription… and add this URL: https://www.thecodehub.ie/playgrounds/adventures/feed.json
The first playground tackles the @StateObject and ObservableObjects in SwiftUI, “the new hotness,” as my old boss would say.
In this playground, we use new files in the UserModule to create a model that will hold minutes for a timer (seconds, really)… we show you how to organize your code to keep the “model” in one place that you could use from multiple locations in your SwiftUI-based app.
UIView and Animation
The second playground shows off creating a UIView in code, making it the live view and animating an image view across the screen.
It’s a nice way to start playing with animation and checking out all the properties you can animate on a UIView.
More to Come
There are more to come, of course, this is just the start. Hopefully these playgrounds will give you an idea for what you can do with the Playgrounds app. Post-WWDC, I’m sure, we’ll have lots more goodies to explore all the fun new toys we have to play with.
I loved the sessions on Swift Playgrounds last year, in particular the first in the Swan’s Quest series. It would be amazing to see more this year. Using those sensors is pretty amazing and eye-opening for a lot of students.
A Swift Playgrounds Community site: some sort of way to easily share Swift Playgrounds with students, fellow developers, where you can just show off your work easily, would be amazing. Think of it like a dynamic Swift Playground feed people could publish to easily from within the Swift Playgrounds app…
Xcode and teaching Develop in Swift
If Xcode had a remote sharing option, so the teacher or co-coder could observe one person typing, that would be an amazing addition to teaching coding. It’d be icing on the cake if we got the same with iPads and Swift Playgrounds, and I need to have a look at the Classroom app update to see if maybe that’s already done.
Some of these collaboration features would be a real boon to teaching people how to code, especially in as rich an environment as Xcode, so any more integration with Github, remote sharing, and the rest would be much appreciated
A web-based version, for those folks who want to try out Swift and app development, would also be amazing. I really like repl.it, especially with its implementation of the Swift REPL and readLine()… but it never hurts to have more options.
RealityKit and Reality Composer
Lastly, and by no means is this an exhaustive list, I would really, really love to see the ability to support more than one image anchor in a Reality Composer scene. We’ve had a few questions lately about supporting them inside the one Reality Scene… and while there are ways to handle this (multiple scenes for each image anchor you want to support, using code and loading ARImageAnchors yourself), this would be a really fun addition to an incredible app. Reality Composer makes it so easy to create engaging, robust experiences with very little to no code already, but a few additions would just ice the cake.
That’s our list, what do you want to see from WWDC21?