concept name in category swift

This is an excerpt from Manning's book Hello Swift!: iOS app programming for kids and other beginners.
If you’re creating apps only so you can learn, I don’t recommend buying a developer account. If you want to submit apps for the whole world to download for money (or for free), you must buy the $99-per-year account in a parent’s name (unless you’re older than 18). I recommend that you do this only after you gain experience building apps. This fee, by the way, includes an iOS, macOS, watchOS, and tvOS developer subscription.
You can create a template for a Dog and use that template to create a specific Dog. Anything in class Dog performs the same actions (or functions), such as barking and tail-wagging, and has a good sense of smell. You can set attributes, or properties, such as name, color, breed, size, amount of fur, tail size, shape of mouth, and eye color in the template to make a final thing—in this case, a final dog. The final thing you create is called an object or instance. The actions that these objects are capable of performing are called functions or methods. Fur color, length of tail, eye color, and other qualities are called variables and properties.
Now that you know the bare-bones details of classes, add some functionality, or functions, to your class. You want to add some functions that let you get and set the value of the variable name:
class TestClass { var name = "" func getName() -> String { return name } func setName(yourName: String) { name = yourName } }You added the getName() -> String function and the setName(yourName: String) function because getting and setting the name in your code becomes easier for you, as you can call these functions as many times and include checks for data validity. (I explain another way of doing this in the Metric Conversion app-excercise later in this chapter.) If you want to print the variable when you set or get it, for example, enter this code:
class TestClass { var name = "" func getName() -> String { print("Name is currently: \(name) ") return name } func setName(yourName: String) { print("Now setting name to: \(yourName) ") name = yourName } }

This is an excerpt from Manning's book iOS Development with Swift.
Throughout this book, you’re going to build an entire app from start to finish that will help users keep track of their books. Users will enter the author’s name, book title, and notes about each book, or—and this is where it gets fancy—they’ll use the handy barcode scanning feature, which will automatically generate the details for each book. We’ll call this app Bookcase. Let’s take a sneak peek of what the finished app looks like right now. We’ll also peek at programming in Swift by making a small change to the code.
var name = "Jerry" var message = "Welcome " + name