How to Add the Weather View Controller to Your iOS App
How to Use Inspector and Quick Help Pane for iOS App Development
How to Use the Library Pane for iOS App Development

Using Frameworks in iOS App Development

One thing that makes iOS software development so appealing is the richness of the tools and frameworks provided in the iOS Software Development Kit (SDK). In this regard, the frameworks are especially important.

Each one is a distinct body of code that actually implements your application’s generic functionality — in other words, frameworks give the application its basic way of working. This is especially true of one framework in particular: the UIKit framework, which is the heart of the user interface.

A framework offers common code that provides generic functionality. The SDK provides a set of frameworks for incorporating technologies, services, and features into your apps. For example, the UIKit framework gives you event-handling support, drawing support, windows, views, and controls that you can use in your app.

A framework is designed to easily integrate the code that runs, say, an app or game or that delivers the information your user wants. A framework is similar to a software library, but with an added twist: It also implements a program’s flow of control (in contrast to a software library, whose components are arranged by the programmer into a flow of control).

So, when working within a framework, the programmer doesn’t have to decide the order in which things should happen — such as which messages are sent to which objects and in what order when an application launches, or when a user touches a button on the screen. Instead, the order of those events, or flow of control, is a part of the framework.

When you use a framework, you provide your app with a ready-made set of basic functions; essentially you’ve told it “Here’s how to act,” and it’s in a position to take the ball and run with it. With the framework in place, all you need to do is add the specific functionality that you want in the app — the content as well as the controls and views that enable the user to access and use that content.

The frameworks and iOS provide pretty complex functionality, such as

  • Launching the app and displaying a window on the screen

  • Displaying controls on the screen and responding to a user action — changing a toggle switch, for example, or scrolling a view, such as the list of your contacts

  • Accessing sites on the Internet, not just through a browser but also from within your own program

  • Managing user preferences

  • Playing sounds and movies

Some developers talk in terms of “using a framework” — but in reality, your code doesn’t use the framework so much as the framework uses your code. Your code provides the functions that the framework accesses; the framework needs your code to become an app that does something other than start up, display a blank window, and then end. This perspective makes figuring out how to work with a framework much easier.

If this seems too good to be true, well, okay, it is — all that complexity (and convenience) comes at a cost. It can be really difficult to get your head around the whole thing and know exactly where (and how) to add your app’s functionality to the functionality that the framework supplies.

That’s where design patterns come in. Understanding the design patterns behind the frameworks gives you a way of thinking about a framework — especially UIKit because it's based on the MVC design pattern — that doesn’t make your head explode.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Create an Xcode Project for an iPad App
How to Customize Your iOS App Table View for the iPad
How to Add a Background Image to Your iOS App
How to Customize Xcode for Your iPad App
How to Add and Set Up the EventPageController in the MainStoryboard in Your iOS App
Advertisement

Inside Dummies.com