Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
iOS Architecture  ›  Lesson

Core OS and Core Services

Core OS 12 miniOS is built in four layers, with Core OS handling the kernel, hardware and security and Core Services providing data, networking and location frameworks such as Foundation and Core Location.

Core OS and Core Services

When TrailLog saves a hike, many things happen that you never write: a file is created on flash storage, it is encrypted, a GPS chip reports your position, a network socket uploads a backup. iOS organises all of that into layers, and knowing them tells you where to look for any capability.

The rule

Four layers, top to bottom: Cocoa Touch, Media, Core Services, Core OS.

Each layer builds on the ones beneath it. Your app mostly talks to the top, and the lower layers do the heavy lifting underneath.

Layer What lives there Examples
Cocoa Touch Screens, touches, app lifecycle UIKit, SwiftUI, notifications
Media Drawing, animation, images, sound, video Core Graphics, Core Animation, AVFoundation, Metal
Core Services Data, networking, location, system services Foundation, Core Data, Core Location, CloudKit
Core OS Kernel, hardware access, security Darwin kernel, file system, drivers, keychain services

This lesson covers the two bottom layers.

Core OS is the foundation shared with macOS: the Darwin kernel, memory and process management, the file system, low-level networking, drivers for hardware, and the security machinery (sandboxing, encryption, the Keychain). Apps rarely call it directly; it is what every higher framework ultimately stands on.

Core Services gives you the everyday building blocks that are not about the screen:

  • Foundation — strings, dates, numbers, collections, URLSession for networking, FileManager, JSONEncoder.
  • Core Data and SwiftData — storing object graphs on the device.
  • Core Location — the user's position.
  • CloudKit — syncing data through iCloud.
import Foundation
import CoreLocation

let saved = Date()                              // Foundation
let manager = CLLocationManager()               // Core Location

The shortcut

To find the right framework, describe the job without mentioning the screen, then pick the highest layer that does it. Going lower than needed means more code and more ways to get it wrong.

Where does TrailLog's work belong?Step 1 of 4
  1. Record the route

    "Know where the phone is." Not a screen job; a system service. Core Services → Core Location.

The trap is thinking lower is faster or better. A raw socket is more work than URLSession and loses features like caching and background transfers.

Drills

Answer fast — trust the rule.

quick drill

Which is the correct order of the iOS layers, top to bottom?

quick drill

TrailLog needs the user's current position. Which framework?

quick drill

Which layer contains the kernel, drivers and file system?

quick drill

Why use URLSession rather than raw sockets to download trail data?

Remember

  • Four layers, top to bottom: Cocoa Touch, Media, Core Services, Core OS.
  • Shortcut: describe the job, then use the highest layer that does it.
  • Core Services is data, networking and location; Core OS is kernel, hardware and security.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainPlace three features

Place these TrailLog features in an iOS layer and name a framework for each: syncing hikes through iCloud, storing the user's password securely, and reading a JSON file of trails. Explain the rule you used to choose.