From the course: Learning Higher-Order Functions with Swift
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Sort
- [Instructor] So now, we're going to get our hands dirty a little bit in Xcode. So, we start up Xcode and I'm going to get started with a playground. I want to make sure it selects IOS and a blank playground. And I will give it the default name of MyPlayground and create it. The first thing I'm going to do is delete the contents and stop it from running. Then I'm going to expand it to take the full screen. I don't want it to run without me selecting it, so, I'll hold this button down, this arrow button in the bottom left, and select Manually Run. Now, I can tell it when to run, instead of it just running all the time. So, I'm going to start with a array of names that we're going to sort. So, I'll type on line one, var names equals, and then I'm going to give it an array literal of Bear, Kyle, Jenna, and Andrew. Then, I want to sort these names. So, I'll just call names.sort. There's no return type and I will print the names. So, there being no return type shows me that it should sort…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.