user6510422 user6510422 - 3 years ago 102
iOS Question

If Apple's multiple frameworks span across each of these layers, why is this iOS layers image stacked in this order?

enter image description here

While researching iOS, I've seen this image brought up numerous times by instructors however the Apple frameworks list is shown as if you're free to pick and choose which framework or classes you'd like to implement without necessarily chiseling down through each layer to use a specific feature. For example, I was under the impression that in order to use blue tooth services I needed to start with a UIKit object such as UIButton and utilize an object from each layer before being allowed to use blue tooth capability but this doesn't appear to be the process when building an app. So my question is why is this image so important or what message is it attempting to relay in regards to the multiple frameworks provided by Apple?

Answer Source

To expand on @Baglan's comment: Each "layer" is a level of abstraction, but none is comprehensive, and you're free to walk up and down the ladders of abstraction as you please.

Layers add abstraction

True, there's no UIKit API (or other API on the highest "layer") that encompasses Bluetooth connectivity. But that's because Bluetooth itself is a lower level technology. There's no usefulness in UIKit presenting an API that's conceptually the same as that offered by CoreBluetooth.

On the other hand, what UIKit and other high-level frameworks do is offer further abstractions from underlying technology where there are use cases for such abstraction. So, even though Apple Pencil and the Siri Remote (for Apple TV) use Bluetooth, UIKit offers APIs that abstract away the details of Bluetooth to let you work with those devices in terms that are more relevant to your user and to the rest of your app.

Layers aren't comprehensive

So, if all you want to do is talk Bluetooth, use the CoreBluetooth framework. If all you want to do is work with audio, use the CoreAudio framework, etc.

Having layers of abstraction doesn't mean that you have to wrap and push through all of them to get to what you need — it means you can drop down to whichever level of abstraction for the work you want to perform.

I was under the impression that in order to use blue tooth services I needed to start with a UIKit object such as UIButton and utilize an object from each layer

In a sense, your impression is actually correct. An iOS app needs some form of UI, and UIKit is the place to do that. So you start with views and buttons, and the code you write for things like responding to button presses can use objects from lower layers as needed for the task at hand.

"Layers" is just one possible roadmap

Moreover, the idea of "layers" is itself an abstraction. With over a hundred developer-accessible frameworks on Apple's platforms, it helps to have some way to think about them in useful clusters. The schemes that Apple tend to use for that usually rely on this idea of layers of abstraction.

But there's more than one such scheme. For example, check out the framework list at — here you'll find six clusters that mix the "layers" metaphor with some more task-oriented ideas: App Frameworks, Graphics and Games, App Services, Media and Web, Developer Tools, and System. Notably, "App Frameworks" isn't just "high level" stuff — together, UIKit, Foundation, and/or Swift Standard Library are the basic tools that everyone needs to make an app, and all the other clusters are for more specific (or lower level) tasks.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download