Skip to the workspace
Pebellslearn by building
iOS Architecture  ›  Lesson

The Media Layer

Media 12 minThe Media layer provides drawing with Core Graphics, animation with Core Animation, image filters with Core Image, audio and video with AVFoundation and Core Audio, and direct GPU access with Metal.

ios / The Media Layer

Explore each scene at your own pace.

01 · The rule

The rule

The Media Layer

TrailLog draws an elevation chart, animates a badge when you finish a hike, adds a warm filter to summit photos, and plays a short voice memo. Four jobs, four different frameworks — all from the Media layer, which sits between Core Services and the user interface.

The rule

Draw with Core Graphics, move with Core Animation, filter with Core Image, play with AVFoundation.

The main Media frameworks, each with one job:

  • Core Graphics (also called Quartz 2D) — 2D drawing: lines, paths, shapes, gradients, PDF. Its geometry types, CGRect, CGPoint, CGFloat, appear all over UIKit.
  • Core Animation — every UIKit view is backed by a CALayer. Core Animation composites those layers and animates their properties (position, opacity, scale) smoothly, handing the work to a separate render process.
  • Core Image — applies filters to images (CIFilter): colour adjustments, blurs, face detection. It uses the GPU when it can.
  • AVFoundation — high-level audio and video: playing (AVPlayer), recording, camera capture, editing.
  • Core Audio — the low-level audio engine under AVFoundation, for precise, low-latency sound work.
  • Metal — direct, low-overhead access to the GPU for custom 3D graphics and parallel computation. Other frameworks, including Core Animation and Core Image, run on top of it.
// Core Graphics: draw the elevation line
let path = UIBezierPath()
path.move(to: CGPoint(x: 0, y: 80))
path.addLine(to: CGPoint(x: 120, y: 20))

// Core Animation: fade the badge in over half a second
badgeView.alpha = 0
UIView.animate(withDuration: 0.5) { badgeView.alpha = 1 }
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.