Apple File System
- Both a volume manager and a filesystem
- inode is extensible: we have optional fields and fields can be added in the future without breaking backward compatibility
- Optimized for latency rather than throughput: apps read many small files
- With space sharing, free space reported is the entire free space on the container
- Copy-on-write cloning for files and directories (useful for packages)
- Copy-on-write snapshots are read-only
- Directory size is stored on the filesystem as an additional record, not in the inode
renamex_np
syscall allows atomically replacing a directory with another one- New syscall was needed because POSIX does not allow these semantics
- This is useful for saving documents that are packages
- Encryption can be one key per volume, file, or extent (part of a file)
- Unifies iOS and Mac encryption models by supporting both of them
- Migration can be done in-place for HFS+ volumes
- Writes new APFS metadata into HFS+ free space
- Converter is not completely atomic, but likely will not lose data
- APFS as default on all devices in 2017
Advances in iOS Photography
- New class:
AVCapturePhotoOutput
- RAW capture
- 10-bit sensor, 14 bits per pixel
- JPEG advantages: multiple image fusion, which you can’t get through RAW capture
- RAW + JPEG capture support
- Uses Adobe Digital Negative (DNG) format
- Wide color capture
- Display P3 (P3-D65) has the same gamma and white point as sRGB, so it’s more compatible than DCI-P3 (superset of sRGB)
- 420f (“full”) capture modes support wide capture
AVCaptureSession
has an option to set wide capture automatically (won’t do it for videos)- Videos don’t do wide by default because most video playback software isn’t color managed
- Shared photos are converted to Apple Wide Color Sharing Profile, where a custom profile is generated so the data can be stored as sRGB but converted back to P3 for color managed devices
Protocol and Value Oriented Programming in UIKit Apps
- How to use value types in UIKit apps
- Local reasoning: just look at the code in front of you, don’t have to think about the context (what is the rest of the code in the program doing)
- Model layer: use
struct
to store and pass information about dreams - Views: layout code is just math, so put it into a struct. The
UITableViewCell
subclass will hold aLayout
and use it to calculate stuff- Easier to write unit tests against the layout algorithm when it’s not part of a
UIView
subclass - Want the layout class to work with unrelated types? Get polymorphism from a protocol so you can take both
UIView
andSKNode
- “Customize through composition rather than inheritance” – don’t have to think about what superclasses & subclasses are doing
- Easier to write unit tests against the layout algorithm when it’s not part of a
- Put all your model structs into a
Model
object, and set it on the view controller. When updating the model, diff the model and apply changes to the view.
Unified Logging and Activity Tracking
- Design goals
- Unify kernel and user mode logging into one system
- Collect a lot of information with minimum cost, by deferring work away from log time
- Can we turn a ton of logging on all the time, instead of increasing the logging after a problem happens?
- New console app
- Track an activity as it’s passed through different proceses
- New file formats
- Log database format is
.tracev3
– no longer text, so need to use Apple’s tools instead of grep .logarchive
for sharing the logs
- Log database format is
- On a fault or error, in-memory logs are collected and preserved in special log files
- Architecture
- Logs are written to memory shared with the
logd
daemon, or messages are IPC’d todiagnosticd
for realtime streaming
- Logs are written to memory shared with the