Hello, my name is Mark Nair, and in these lessons, we'll go through an overview of Swift Playgrounds, how we use live preview in Xcode Playgrounds, and how to use rendered markup in Playgrounds. We'll be working with Xcode Playgrounds for most of this course, but there's another tool you can use to practice your Swift skills and actually create your own apps without using Xcode, that's Swift Playgrounds. So you can run Swift Playgrounds on the Mac or the iPad. Let's take a look at how you do it. So I'm on the Mac right now and this is in the App Store. It's Swift Playgrounds. It's free. Learn real coding the fun way. Sounds pretty great. So I'm just gonna grab it and open it. A lot of choices in Swift Playgrounds. And I want to take a peek at just what the playground is itself. So I have these things that are hanging around and I can investigate, and we'll take a peek at some of these here in a minute. But what I like to do is come down at the bottom and just click Playground, My Playground and open that up. So pretty sparse. Click to enter code. Well, let's try something. So a little bit of code. All I like to do is roll a dye, but the dye has 100 slides on it. So I'm going to generate a random number between 1 and 100. And then I'm going to append that to an array called Number Array, and I'm going to print that out. So in Playgrounds, in Swift Playgrounds just some Swift code here. I don't really see the thing I'm used to doing, but if I come down here to this button and run my code, and then I can click this. Well, there it is. There is my array of random values. Okay, looking pretty good. Do this again. Yeah. Now, there's a button next to it. If I click this, I can use this to go the code step by step. Let's try this step through my code. So we can see the arrow and it's highlighting in the code what's going on. So it's gonna take a long time 'cause it's 100, but one at a time, a random number keeps going. Now, I'm not seeing the display change, of course, but it is appending to the array five times, six times. Okay, so far so good. So this runs our Swift code perfectly fine, but let's take a look at some of the other things inside of Playgrounds that might be pretty interesting. I'm gonna take a look at the app button, plus app right here. Open this up. So at the beginning of a SwiftUI app. So here's the preview. Hello world. Here's my app. Looking good. I can change the content inside of the code. Hello there! Changes there. That's good. And it's using an image from the system name. Pretty good. So now I can see that I can start writing my own SwiftUI code or my regular Swift code that SwiftUIs can take and start building my own app inside of Playgrounds. Very handy. This is very, very handy to use. If I'm using an iPad, I'm just on the go. Previously, you couldn't really make your own app. You could just experiment, but now you can. So let's take a look at a few other things that come with Playgrounds, the Swift Playgrounds. There are a few things in here. Learn to code fundamentals, meme creator, nice interesting little things that are pretty fun. What happens is there is a tutorial that works through it with you. So for example, if I select Choose Your Own Story, now, I'll get this kind of template for me and I'll open it up. Now, inside of here, I have this message. You're the author. You're gonna write your own story. Learn more about it. All right, now I'm on this Swift file. It's a SwiftUI view of first chapter, and walking me through the pieces that I need to do to start doing my app. Well, it looks pretty good. There's some information down here about how SwiftUI needs previews and and how the struct works and how it's laying it out inside of this title. But so far pretty good, and then a lot of the other things that it needs over here are already pre-built for us so we don't have to create them from scratch. A lot of things get a little complicated in here, but really for this, you don't have to worry about it. The same thing with animating shapes, for example. Take a peek at this. Let's take a look at some of this. The Heart pulse. If I play this code, there's an animated heart. The heart drawn with CT points, colors, pulsating, step by step in the code to really understand it, but it is Swift code just using this SwiftUI framework. One other piece I wanna show you is this, getting started with apps. Open this up. Well, good. Okay, so it's an understanding of SwiftUI, certain tasks, learning SwiftUI, some easy introductions to what this new framework is. So feel free to experiment and explore it. Use your basic Swift skills to build out. If you're sitting having waffles one day and your iPad's handy and you just wanna type out some code or have an idea, use it for that basic exploration. Use it for testing out different pieces. Playgrounds are very handy to do that. And then also going through some of the other information, there's some augmented reality, little modules, a few other things in audio, some really interesting things. And then there's some subscription things where other people have built things that you could use and learn. You could do the same thing as well. And Apple has a list of interesting tutorials from Worldwide Developers Conference that talks exactly about using Swift Playgrounds to build your own. Then you can give that content to other people who are actually gonna build on top of yours or learn from you. So take a look at it. It's very fun, it's very friendly. And now with your basic Swift skills, you can just hop in and make some amazing things. Now for us, we're gonna go back to Xcode Playgrounds for the rest of the course to really work on our intermediate development features of Swift. Thanks for watching. Stay tuned for the next lesson where I'll show you how to use live previews in Playgrounds.