concept class in category ios

This is an excerpt from Manning's book Hello! iOS Development.
To describe what an object can remember and what messages it understands, you create a class in Xcode. It can be confusing to remember the difference between classes and objects. Just remember that classes are what you write in Xcode. They’re the blueprints. Xcode takes those blueprints and creates an app. When you run the app, it creates the objects that are the “living, breathing things” that make the app do something. Multiple objects can be made from the same class. For example, most of the button objects you see in an app are made from one class.
![]()
To help keep things straight, in diagrams in this book, classes will be in rectangles and objects will be in circles. Here are the parts of a class.
You create classes in Xcode to describe the objects that will do what you want your app to do. In your class, you define the messages that each object will be able to understand and what it needs to remember. But objects need to collaborate in order to get their work done. To do that, you need to connect them.
To finish an app, you’ll go through this loop many times, refining it on each pass. You already know how to create designs by sending messages to classes that are organized into models, views, and controllers, so you’re halfway there.
![]()
Representing those designs as code is the most exacting of the three skills you need to create an app. Your notebook won’t complain if it doesn’t like your sketch or design, but Xcode will put up error after error if you don’t get the syntax exactly right. In reading this chapter, pay attention to every detail about creating classes, messages, and properties.
In your designs, you spent a lot of time thinking about what the classes should be, what properties they should have, and what messages they need to respond to and send. You’ve also learned that classes can be in different kinds of relationships with each other. In Objective-C, you’ll see each piece of the class in two places, the header and the module, which together define the parts of a class.
![]()

This is an excerpt from Manning's book Hello Swift!: iOS app programming for kids and other beginners.
Imagine that ten kids have to give reports to the class. The teacher gives each one a piece of paper with a number from 1 to 10 on it. Frank gets 1, Amy gets 2, Maya gets 3, Tom gets 4, Timmy gets 5, and so on. This list is similar to an array in programming. An array is an ordered set of variables. In this example, the values are these kids’ names, and the numbers on the pieces of paper control the order:
I’ll start by giving you a bird’s-eye view of what classes are and then show you how to code them.
var name: String = "Frank"I have a variable called name inside a class, with the value set to Frank. What if I want to do something with it? How do I access this class’s variable, called name, from the rest of the playground?
Before I answer, type the name variable in the playground outside the class. Go ahead; I’ll wait.
If you guessed "Frank", you’re right! When you changed the name earlier, you changed only that specific box’s (testClassInstance) name. You didn’t change the variable stored in the class; only the variable that was inside the specific box instance (testClassInstance) changed, as illustrated in figure 9.1.

This is an excerpt from Manning's book iOS Development with Swift.
Select Class Reference (at the bottom of the documentation text, next to the label More) to open more-detailed information in the documentation. UIButton is the name of the class underlying all standard buttons, provided to you by Apple in the UIKit framework. You’ll find the UIKit framework ubiquitous in iOS development—it’s essential for working with the views, view controllers, events, animation, and a myriad of other functions within iOS.
Now that you have a class, you can create (or instantiate) your class with the name of the type, followed by parentheses, and assign this object to a variable: var distance = Distance()
Classes aren’t the only “type of thing” in Swift. An alternative approach to creating objects in Swift is with a structure.
Structures have many similarities to classes. For example, they can
If you predicted "blue", pat yourself on the back! Because classes are reference types, when color1 was assigned to the color2 variable, color2 was assigned the reference to the underlying Color object (see figure 3.5).

This is an excerpt from Manning's book Anyone Can Create an App: Beginning iPhone and iPad programming.
Classes are like the general idea of something in the real world. Consider a pen. When you think of a pen, you have a pretty good idea of what it is, how it works, and how to use it. It has some kind of ink, it may or may not have a lid or a cap, and it may or may not have a spring-loaded button to enable writing—but it is still a pen. A pen is like a class in programming. It’s the definition of a set of expected behaviors (making marks on something) and basic structure (it should be cylindrical and have some way to hold the ink). Again, the pen “definition” here is like a class. Hold that concept in mind as we move on to the definition of objects. Objects are instances of the class. Imagine you have a pen in front of you that you can touch and hold. That’s an object. It is a type of pen (the overall class), but is also an instance of a pen (the object). If you grab a second pen, it may or may not look anything like your first pen, but it is still a pen. You now have two instances of the class pen, or two objects of type pen. You can think of objects in programming in the same way. Objects of the same type (such as pens in the real world, or labels in the programming world) will behave the same way (making marks on something, displaying text) and will look similar (pens can be a variety of colors and shapes, but you still know they’re pens, and labels can be a variety of sizes and colors and they’re still labels).
You need to implement the done() function using your delegate method as well, but it’s expecting you to pass in the LioN object, and you don’t have one yet. Add the following to the top of the class, under the class definition:

This is an excerpt from Manning's book iOS 7 in Action.
Frameworks are compiled libraries that you can use to add functionality to your applications. By default, when you create a new iOS project in Xcode, it automatically includes the frameworks UIKit, Foundation, and CoreGraphics. UIKit provides classes to create and manage user interfaces. Foundation provides the base layer of Objective-C classes. Core Graphics provides functionality based on the Quartz drawing engine. It aids with image manipulation, color management, gradients, shadings, and the like. These three frameworks give you the basic functionality to create iOS applications.
If you wanted to access all of the photos and videos on your iOS device, you could use the Assets Library framework, which contains classes that allow you to do just that. If you were to build a web browser, you’d use the WebKit framework. You’ll be using various frameworks to add in functionality to the apps that you build in the book. You’ve now had a general overview and introduction to OOP, Objective-C syntax, message passing, MVC, and frameworks. Because you’ll be spending most of your time in Xcode, let’s go over it in more detail so that you become more comfortable with your development environment.
Now that you know how the JSON format is defined and how the serialization process takes place, let’s go back to your application. You’ll implement the code for retrieving Chuck Norris jokes. First, you need to import the IAHTTPCommunication class you created previously and declare the instance variables you’re going to use in the class. For that you’ll open the file IAViewController.m, and on top of the file, right after the #import, you’ll add the code in the following listing.

This is an excerpt from Manning's book iOS in Practice.
Creating classes based on CoreData entities can be useful in accessing the data. But you probably don’t want to edit that code after you create it. If you need to change your entity definition later and regenerate the code, it will blow away your changes. To avoid this, you can create helper classes or child classes instead.

This is an excerpt from Manning's book Objective-C Fundamentals.
For now, let’s focus on understanding the general structure of an Objective-C–based project. Objective-C is an object-oriented language, meaning that a large portion of your coding efforts will be spent defining new classes (types of objects). Listing 1.1 defines a new class called CoinTossViewController. By convention, the definition of a class is kept in a header file that uses a *.h file extension.
In the CoinTossViewController header file, the first two lines declare that the class stores the details of two UILabel controls located somewhere in the user interface. A UILabel can display a single line of text, and you use these labels to display the results of the coin toss.
To put the concepts into context, we concentrate on updating the Rental Manager application to use object-oriented design principles, replacing the Rental-Property structure with a class that provides equivalent functionality. The new class will store and maintain the details of a single rental property, which means you must specify what data each object should keep track of and add instance and class methods to allow safe and controlled access to that data.
A property typically indicates the presence of both a getter and setter method. By adding the readonly attribute to a property declaration, you can ensure that users of the class can only query the current value of the property and can’t change its value. For example, the following declaration specifies that the age property has only a getter method:
@property (readonly) int age;The default behavior of each property having a getter and setter method can also explicitly be specified using the readwrite attribute. Because a readonly property has no setter, code in the class would have to modify the associated instance variable directly.
The interface of a class defines the “public face” of a class—what the class looks like and how it can be interacted with. The interface declaration describes the kind of data the class stores and the various messages you can send it to perform tasks on your behalf. It’s designed to provide enough details for other sections of an application to make use of the class without providing any details on how the class physically achieves its stated capabilities.
The declaration of a new class is signaled by the @interface compiler directive. Everything from this point on, until a matching @end directive, makes up the interface of the class. You may think the use of a directive named @class would make more sense. One way to remember this apparent discrepancy is to realize that your interface must eventually be matched with a suitable implementation, and indeed there is a matching @implementation directive that we cover later in this chapter.

This is an excerpt from Manning's book iOS 4 in Action: Developing iPhone and iPad Apps.
Within these frameworks, you can access an immense wealth of classes arranged in a huge hierarchy. You’ll see many of these used throughout this book, and you’ll find a listing of even more in appendix A. Figure 1.5 shows many of the classes that you’ll use over the next several chapters, arranged in a hierarchy. They’re a fraction of what’s available.
Let’s start with a look at Objective-C’s big picture. It’s an object-oriented language, which means it’s full of classes and objects, instance variables, and methods.

This is an excerpt from Manning's book iPhone and iPad in Action: Introduction to SDK Development.
As we’ve noted, each class tends to be represented by a matched pair of files: a header file and a source code file. To define a class, each of these files must contain a special compiler directive, which is always marked in Objective-C with an @ symbol.
First, you define the interface for the class, which is a simple declaration of its public variables and methods. You do this in the header (.h) file. Next, you define the implementation for the class, which is the content of all its methods; this is done in a source (.m) file.
Table 3.1. Several types of files show up in your Xcode projects.
File
Summary
project.app A compiled application. *.framework A standard framework included as part of your project. By default, every project should include Foundation, giving you access to NS objects; UIKit, giving you access to UI objects; and Core Graphics, giving you access to various graphics functions. We’ll talk later about adding additional frameworks. *.h A header file, usually containing the @interface for a class. *.m A source code file, usually containing the @implementation for a class. *.mm A source code file with C++ code. Not used in this book. project_Prefix.pch A file containing special prefix headers, which are imported into every one of your source code files. It’s here that the two main frameworks are imported. Info.plist An XML property list. It contains a number of instructions for your program compilation, the most important of which is probably the reference to the .xib file used in your program. MainWindow.xib An Interface Builder file, more broadly called a nib file. This is your connection to the interface design program that may be used to easily create interfaces for your project. We’ll discuss it in depth in the next chapter.

This is an excerpt from Manning's book iPhone in Action: Introduction to Web and SDK Development.
To apply an animation, you just set a box to use the class. If you do this in your regular HTML code, the animation will begin the instant your web page loads. Alternatively, you can change a class name to the animated class when a button click or some other event occurs. For example, if a button in your application requires a doubleclick, you could start the button shivering when it’s clicked the first time to encourage a second click.
Objects are specific instances of classes. The class is where the variable and method descriptions actually appear. An individual object then takes all of that information, and starts setting its own version of the variables as it sees fit.
Classes gain power because they support inheritance. That means that you can subclass an existing class. Your subclass starts off with all the default variables and methods for its parent class, but you can now supplement or even override them.
It’s frequent for a subclass to override a parent method by first calling the parent method, then doing a few things to vary how it works. For example, if you had a class that represented an eating utensil, it might include a simple method to transfer solid food from your plate to your mouth. If you created a subclass for a spoon, it could include a new method that worked on liquids.
Once you’ve created a hierarchy of classes and subclasses, you can store them away in a class library. When you put several of those together you have a software framework, and that’s what we’ll be working with in the SDK, as Apple has provided numerous frameworks to make your programming of the iPhone easier.