415 wwdc 2018 behind the scenes of the xcode build process
TRANSCRIPT
![Page 1: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/1.jpg)
#WWDC18
© 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
•Behind the Scenes of the •Xcode Build Process •Session 415
Jake Petroules, Xcode Build System Team Jürgen Ributzka, Clang Frontend Team Devin Coughlin, Program Analysis Team Louis Gerbarg, Linker Team
![Page 2: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/2.jpg)
Exploring the Xcode Build Process
![Page 3: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/3.jpg)
Exploring the Xcode Build Process: Build System
![Page 4: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/4.jpg)
Exploring the Xcode Build Process: Clang and Swift
![Page 5: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/5.jpg)
Exploring the Xcode Build Process: Linker
![Page 6: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/6.jpg)
![Page 7: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/7.jpg)
![Page 8: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/8.jpg)
Build Process: Execution of a Collection of Tasks
Compile PetViewController.m
Compile PetController.swift
Compile PetView.swift
Generate PetWall-Swift.hCompile Main.storyboard
Link PetWall
Process Info.plist
CodeSign PetWall.app
Run GenerateDocs.shCompile Assets.xcassets
![Page 9: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/9.jpg)
Generate PetWall-Swift.hCompile Main.storyboard
Process Info.plist
CodeSign PetWall.app
Run GenerateDocs.shCompile Assets.xcassets
Build Process: Execution of a Collection of Tasks
Link PetWall
Compile PetViewController.m
Compile PetController.swift
Compile PetView.swift
![Page 10: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/10.jpg)
Build Process: Execution of a Collection of Tasks
CodeSign PetWall.app
Run GenerateDocs.sh
Link PetWall
Compile PetViewController.m
Compile PetController.swift
Compile PetView.swift
Process Info.plistCompile Assets.xcassets
Compile Main.storyboardGenerate PetWall-Swift.h
![Page 11: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/11.jpg)
Build Process: Execution of a Collection of Tasks
Generate PetWall-Swift.h
Link PetWall
Compile PetViewController.m
Compile PetController.swift
Compile PetView.swift
Process Info.plistCompile Assets.xcassets
Compile Main.storyboard
CodeSign PetWall.app
Run GenerateDocs.sh
![Page 12: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/12.jpg)
Build Process: Execution of a Collection of Tasks
$ swiftc -module-name PetWall -target arm64-apple-ios12.0 -swift-version 4.2 ... $ clang -x objective-c -arch arm64 ... PetViewController.m -o PetViewController.o $ ld -o PetWall -framework PetKit PetViewController.o ... $ actool --app-icon AppIcon ... Assets.xcassets $ ... $ [thousands more]
![Page 13: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/13.jpg)
The build process automates a series of tasks
![Page 14: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/14.jpg)
![Page 15: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/15.jpg)
![Page 16: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/16.jpg)
![Page 17: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/17.jpg)
1. Compile PetView.swift
2. Compile PetController.swift
3. Compile PetViewController.m
6. Process Info.plist
4. Compile Main.storyboard
5. Compile Assets.xcassets
7. Link PetWall
PetWall.app
Build Task Execution Order
![Page 18: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/18.jpg)
1. Compile PetView.swift
2. Compile PetController.swift
3. Compile PetViewController.m
6. Process Info.plist
4. Compile Main.storyboard
5. Compile Assets.xcassets
7. Link PetWall
PetWall.app
Build Task Execution Order
PetViewController.m PetViewController.o
![Page 19: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/19.jpg)
1. Compile PetView.swift
2. Compile PetController.swift
3. Compile PetViewController.m
6. Process Info.plist
4. Compile Main.storyboard
5. Compile Assets.xcassets
7. Link PetWall
PetWall.app
Build Task Execution Order
PetWall
PetController.o
PetView.o
PetViewController.o
![Page 20: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/20.jpg)
Build Task Dependency Order
PetController.o
PetView.o
PetViewController.o
Compile PetController.m
Compile PetView.m
Compile PetViewController.m
PetController.m
PetView.m
PetViewController.m
Link PetWall
![Page 21: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/21.jpg)
Build Task Dependency Order
PetController.o
PetView.o
PetViewController.o
Compile PetController.m
Compile PetView.m
Compile PetViewController.m
PetController.m
PetView.m
PetViewController.m
Link PetWall
![Page 22: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/22.jpg)
Build tasks are executed independency order
![Page 23: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/23.jpg)
What Happens When You Press Build?
![Page 24: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/24.jpg)
What Happens When You Press Build?
![Page 25: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/25.jpg)
Build Process Represented as a Directed Graph
PetKit.framework
Process Info.plist Compile Assets.xcassets
Compile Main.storyboard
Compile PetView.swift
PetWall.app
Compile PetController.swift
Compile PetViewController.m
Generate PetWall-Swift.h
Link PetWall
![Page 26: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/26.jpg)
Execution of the Build Graph
Process Info.plist
Compile Assets.xcassets
Compile Main.storyboard
Compile PetView.swift
PetWall.app
Compile PetController.swift
Compile PetViewController.m
Generate PetWall-Swift.h Link PetWall
![Page 27: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/27.jpg)
Execution of the Build Graph
Process Info.plist
Compile Assets.xcassets
Compile Main.storyboard
Compile PetView.swift
PetWall.app
Compile PetController.swift
Compile PetViewController.m
Generate PetWall-Swift.h Link PetWall
Time
![Page 28: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/28.jpg)
llbuild Execution Engine: Open Source
![Page 29: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/29.jpg)
Discovered Dependencies
PetController.oPetController.m
PetController.h
Compile PetController.m
![Page 30: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/30.jpg)
Discovered Dependencies
PetController.oPetController.m
Compile PetController.m
PetController.h
![Page 31: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/31.jpg)
Discovered Dependencies
PetController.d
PetController.oPetController.m
Compile PetController.m
PetController.h
![Page 32: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/32.jpg)
Discovered Dependencies
PetController.d
PetController.oPetController.m
Compile PetController.m
PetController.h
![Page 33: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/33.jpg)
Discovered Dependencies
PetController.d
PetController.oPetController.m
Compile PetController.m
PetController.h
![Page 34: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/34.jpg)
Discovered Dependencies
PetController.d
PetController.oPetController.m
Compile PetController.m
PetController.h
![Page 35: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/35.jpg)
PetKit.framework
Process Info.plist Compile Assets.xcassets
Compile Main.storyboard
Compile PetView.swift
Compile PetController.swift
Generate PetWall-Swift.h
Incremental Builds
Compile PetViewController.m
Link PetWall
PetWall.app
![Page 36: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/36.jpg)
PetKit.framework
Process Info.plist Compile Assets.xcassets
Compile Main.storyboard
Compile PetView.swift
Compile PetController.swift
Generate PetWall-Swift.h
Incremental Builds
Compile PetViewController.m
Link PetWall
PetWall.app
File modified
![Page 37: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/37.jpg)
Change Detection and Task Signatures
![Page 38: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/38.jpg)
Change Detection and Task Signatures
•Each task in the build graph has a signature
•
![Page 39: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/39.jpg)
Change Detection and Task Signatures
•Each task in the build graph has a signature •Computed from stat info of inputs and other task metadata
•
![Page 40: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/40.jpg)
Change Detection and Task Signatures
•Each task in the build graph has a signature •Computed from stat info of inputs and other task metadata •Build system tracks task signatures of current and previous build •
![Page 41: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/41.jpg)
Change Detection and Task Signatures
•Each task in the build graph has a signature •Computed from stat info of inputs and other task metadata •Build system tracks task signatures of current and previous build •Compared to determine whether a task should be run
![Page 42: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/42.jpg)
How can you help the build system?
![Page 43: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/43.jpg)
1. Compile PetView.swift
2. Compile PetController.swift
3. Compile PetViewController.m
4. Process Info.plist
5. Compile Main.storyboard
6. Compile Assets.xcassets
...
PetWall.app
![Page 44: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/44.jpg)
Don't Think About the Order of Task Execution!
1. Compile PetView.swift
2. Compile PetController.swift
3. Compile PetViewController.m
4. Process Info.plist
5. Compile Main.storyboard
6. Compile Assets.xcassets
...
PetWall.app
![Page 45: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/45.jpg)
PetKit.framework
Process Info.plist Compile Assets.xcassets
Compile Main.storyboard
Compile PetView.swift
PetWall.app
Compile PetController.swift
Generate PetWall-Swift.h
Think in Terms of Task Dependencies
Compile PetViewController.m
Link PetWall
![Page 46: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/46.jpg)
PetKit.framework
Process Info.plist Compile Assets.xcassets
Compile Main.storyboard
Compile PetView.swift
PetWall.app
Compile PetController.swift
Generate PetWall-Swift.h
Think in Terms of Task Dependencies
Compile PetViewController.m
Link PetWall
![Page 47: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/47.jpg)
Where Do Dependencies Come From?
•Built in •Target dependencies •Implicit dependencies •Build phase dependencies •Scheme order dependencies
![Page 48: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/48.jpg)
Where Do Dependencies Come From?
•Built in •Target dependencies •Implicit dependencies •Build phase dependencies •Scheme order dependencies
![Page 49: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/49.jpg)
Where Do Dependencies Come From?
•Built in •Target dependencies •Implicit dependencies •Build phase dependencies •Scheme order dependencies
![Page 50: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/50.jpg)
Where Do Dependencies Come From?
•Built in •Target dependencies •Implicit dependencies •Build phase dependencies •Scheme order dependencies
![Page 51: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/51.jpg)
Where Do Dependencies Come From?
•Built in •Target dependencies •Implicit dependencies •Build phase dependencies •Scheme order dependencies
![Page 52: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/52.jpg)
Where Do Dependencies Come From?
•Built in •Target dependencies •Implicit dependencies •Build phase dependencies •Scheme order dependencies
![Page 53: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/53.jpg)
You!
![Page 54: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/54.jpg)
Declare Inputs and Outputs!
![Page 55: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/55.jpg)
Declare Inputs and Outputs!
![Page 56: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/56.jpg)
Avoid Auto-Link for Project Dependencies
![Page 57: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/57.jpg)
Add Explicit Dependencies
![Page 58: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/58.jpg)
Create Workspaces and Project References
![Page 59: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/59.jpg)
![Page 60: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/60.jpg)
Building Faster in Xcode WWDC 2018
![Page 61: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/61.jpg)
Jürgen Ributzka, Clang Frontend Team
•Behind the Scenes of the Xcode •Build Process: Clang Builds
![Page 62: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/62.jpg)
![Page 63: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/63.jpg)
What Is Clang?
![Page 64: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/64.jpg)
What Is Clang?
Apple’s official compiler for the C language family
• C
• C++
• Objective-C
• Objective-C++
![Page 65: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/65.jpg)
Traditional C Language Compilation
Clang Compiler
m .o
![Page 66: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/66.jpg)
Traditional C Language Compilation
Clang Compiler
m
h
.o
![Page 67: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/67.jpg)
Traditional C Language Compilation
h m
![Page 68: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/68.jpg)
Traditional C Language Compilation
h m
![Page 69: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/69.jpg)
Traditional C Language Compilation
h m
![Page 70: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/70.jpg)
Traditional C Language Compilation
Clang Compiler
m
h
h
.o
![Page 71: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/71.jpg)
Traditional C Language Compilation
Clang CompilermhhClang CompilermhhClang CompilermhhClang Compilermhh
.o
.o
.o
.o
![Page 72: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/72.jpg)
![Page 73: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/73.jpg)
![Page 74: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/74.jpg)
PetWall Example
![Page 75: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/75.jpg)
PetWall Example
![Page 76: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/76.jpg)
PetWall Example
![Page 77: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/77.jpg)
PetWall Example
![Page 78: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/78.jpg)
PetWall Example
![Page 79: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/79.jpg)
PetWall Example
![Page 80: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/80.jpg)
PetWall Example
// // Cat.mm // PetKit // #import <PetKit/Cat.h> #import “PetSupport.h”
// // NorwegianCat.h // PetKit // #import <PetKit/Cat.h>
![Page 81: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/81.jpg)
How do we find your headers?
![Page 82: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/82.jpg)
// // Cat.mm // PetKit // #import <PetKit/Cat.h>
@implementation Cat
- (NSInteger)_sizeOfCat { return 10; } - (void)meow { theCatsMeow((int)self._sizeOfCat);
How Do We Find Our Cat?
![Page 83: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/83.jpg)
How Do We Find Our Cat?
![Page 84: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/84.jpg)
How Do We Find Our Cat?
![Page 85: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/85.jpg)
On the Search for Our Cat
$ clang <list of arguments> -c Cat.mm -o Cat.o -v
![Page 86: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/86.jpg)
On the Search for Our Cat
#include "..." search starts here:#include <...> search starts here:
![Page 87: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/87.jpg)
On the Search for Our Cat
#include "..." search starts here:PetKit-generated-files.hmap (headermap)PetKit-project-headers.hmap (headermap)#include <...> search starts here:PetKit-own-target-headers.hmap (headermap)PetKit-all-target-headers.hmap (headermap)DerivedSourcesBuild/Products/Debug (framework directory)Header and Framework Locations in the SDK
![Page 88: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/88.jpg)
What Are Header Maps?
PetKit.h PetKit/PetKit.h
Cat.h PetKit/Cat.h
CatLogic_Private.h /x/src/PetKit/PetKit/CatLogic_Private.h
PetKit/Cat.h /x/src/PetKit/PetKit/Cat/Cat.h
PetKit/PetKit.h /x/src/PetKit/PetKit/PetKit.h
PetKit-own-target-headers.hmap:
PetKit-project-headers.hmap:
![Page 89: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/89.jpg)
What Are Header Maps?
PetKit.h PetKit/PetKit.h
Cat.h PetKit/Cat.h
CatLogic_Private.h /x/src/PetKit/PetKit/CatLogic_Private.h
PetKit/Cat.h /x/src/PetKit/PetKit/Cat/Cat.h
PetKit/PetKit.h /x/src/PetKit/PetKit/PetKit.h
PetKit-own-target-headers.hmap:
PetKit-project-headers.hmap:
![Page 90: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/90.jpg)
What Are Header Maps?
PetKit.h PetKit/PetKit.h
Cat.h PetKit/Cat.h
CatLogic_Private.h /x/src/PetKit/PetKit/CatLogic_Private.h
PetKit/Cat.h /x/src/PetKit/PetKit/Cat/Cat.h
PetKit/PetKit.h /x/src/PetKit/PetKit/PetKit.h
PetKit-own-target-headers.hmap:
PetKit-project-headers.hmap:
![Page 91: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/91.jpg)
What Are Header Maps?
PetKit.h PetKit/PetKit.h
Cat.h PetKit/Cat.h
CatLogic_Private.h /x/src/PetKit/PetKit/CatLogic_Private.h
PetKit/Cat.h /x/src/PetKit/PetKit/Cat/Cat.h
PetKit/PetKit.h /x/src/PetKit/PetKit/PetKit.h
PetKit-own-target-headers.hmap:
PetKit-project-headers.hmap:
![Page 92: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/92.jpg)
Common Project Issues with Header Maps
Header is not part of the project
Headers with the same name shadow each other
![Page 93: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/93.jpg)
How do we find system headers?
![Page 94: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/94.jpg)
// // Pet.h // PetKit //
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN @interface Pet : NSObject - (instancetype)initWithName:(NSString *)name; @property (readonly) NSString *name; @property (readonly) BOOL isHungry; - (void)eat;
How Do We Find Foundation.h?
![Page 95: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/95.jpg)
On the Search for Foundation.h
#include "..." search starts here:PetKit-generated-files.hmap (headermap)PetKit-project-headers.hmap (headermap)#include <...> search starts here:PetKit-own-target-headers.hmap (headermap)PetKit-all-target-headers.hmap (headermap)DerivedSourcesBuild/Products/Debug (framework directory)$(SDKROOT)/usr/include$(SDKROOT)/System/Library/Frameworks.(framework directory)
![Page 96: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/96.jpg)
#include.<...> search starts here:.
A$(SDKROOT)/usr/include $(SDKROOT)/System/Library/Frameworks.(framework directory).
On the Search for Foundation.h
![Page 97: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/97.jpg)
A$(SDKROOT)/usr/include $(SDKROOT)/System/Library/Frameworks.(framework directory).
#include.<...> search starts here:.
On the Search for Foundation.h
![Page 98: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/98.jpg)
On the Search for Foundation.h
A$(SDKROOT)/usr/include $(SDKROOT)/System/Library/Frameworks.(framework directory).
#include.<...> search starts here:.
![Page 99: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/99.jpg)
On the Search for Foundation.h
$(SDKROOT)/usr/include/Foundation/Foundation.h
![Page 100: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/100.jpg)
On the Search for Foundation.h
$(SDKROOT)/usr/include/Foundation/Foundation.h
![Page 101: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/101.jpg)
On the Search for Foundation.h
A$(SDKROOT)/usr/include $(SDKROOT)/System/Library/Frameworks.(framework directory).
#include.<...> search starts here:.
![Page 102: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/102.jpg)
On the Search for Foundation.h
$SDKROOT/System/Library/Frameworks/Foundation.framework
![Page 103: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/103.jpg)
On the Search for Foundation.h
$SDKROOT/System/Library/Frameworks/Foundation.framework
![Page 104: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/104.jpg)
On the Search for Foundation.h
$SDKROOT/System/Library/Frameworks/Foundation.framework
$SDKROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h
![Page 105: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/105.jpg)
On the Search for Foundation.h
$SDKROOT/System/Library/Frameworks/Foundation.framework
$SDKROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h
![Page 106: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/106.jpg)
On the Search for Bogus.h
$SDKROOT/System/Library/Frameworks/Foundation.framework
$SDKROOT/System/Library/Frameworks/Foundation.framework/Headers/Bogus.h
![Page 107: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/107.jpg)
On the Search for Bogus.h
$SDKROOT/System/Library/Frameworks/Foundation.framework
$SDKROOT/System/Library/Frameworks/Foundation.framework/Headers/Bogus.h
![Page 108: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/108.jpg)
On the Search for Bogus.h
$SDKROOT/System/Library/Frameworks/Foundation.framework
$SDKROOT/System/Library/Frameworks/Foundation.framework/Headers/Bogus.h
$SDKROOT/System/Library/Frameworks/Foundation.framework/PrivateHeaders/Bogus.h
![Page 109: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/109.jpg)
On the Search for Bogus.h
$SDKROOT/System/Library/Frameworks/Foundation.framework
$SDKROOT/System/Library/Frameworks/Foundation.framework/Headers/Bogus.h
$SDKROOT/System/Library/Frameworks/Foundation.framework/PrivateHeaders/Bogus.h
![Page 110: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/110.jpg)
![Page 111: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/111.jpg)
![Page 112: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/112.jpg)
!89
![Page 113: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/113.jpg)
#import <Foundation/Foundation.h>
![Page 114: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/114.jpg)
headers included
>800
![Page 115: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/115.jpg)
of source code
>9MB
![Page 116: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/116.jpg)
How can we do better?
![Page 117: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/117.jpg)
Clang Modules
On-disk cached header representation
Reusable
Faster build times
![Page 118: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/118.jpg)
Module Properties
![Page 119: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/119.jpg)
Module Properties
Context-free:
![Page 120: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/120.jpg)
Module Properties
#define ENABLE_CHINCHILLA 1 // ignored#import <PetKit/PetKit.h>
#define ENABLE_DOG 1 // ignored#import <PetKit/PetKit.h>
Context-free:
![Page 121: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/121.jpg)
Module Properties
#define ENABLE_CHINCHILLA 1 // ignored#import <PetKit/PetKit.h>
#define ENABLE_DOG 1 // ignored#import <PetKit/PetKit.h>
Context-free:
Self-contained:
![Page 122: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/122.jpg)
Module Properties
#define ENABLE_CHINCHILLA 1 // ignored#import <PetKit/PetKit.h>
#define ENABLE_DOG 1 // ignored#import <PetKit/PetKit.h>
#import <Foundation/Foundation.h> // import not required before PetKit module#import <PetKit/Cat.h>
Context-free:
Self-contained:
![Page 123: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/123.jpg)
#import <Foundation/NSString.h>
![Page 124: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/124.jpg)
Foundation Framework
Foundation.framework/ Headers/ Foundation.h NSString.h ... Modules/ module.modulemap
![Page 125: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/125.jpg)
Foundation Framework
Foundation.framework/ Headers/ Foundation.h NSString.h ... Modules/ module.modulemap
![Page 126: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/126.jpg)
Foundation Framework
Foundation.framework/ Headers/ Foundation.h NSString.h ... Modules/ module.modulemap
![Page 127: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/127.jpg)
// Module Map - Foundation.framework/Modules/module.modulemap
framework module Foundation [extern_c] [system] { umbrella header "Foundation.h"
export * module * { export * }
explicit module NSDebug { header "NSDebug.h" export * } }
![Page 128: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/128.jpg)
// Module Map - Foundation.framework/Modules/module.modulemap
framework module Foundation [extern_c] [system] { umbrella header "Foundation.h"
export * module * { export * }
explicit module NSDebug { header "NSDebug.h" export * } }
![Page 129: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/129.jpg)
// Module Map - Foundation.framework/Modules/module.modulemap
framework module Foundation [extern_c] [system] { umbrella header "Foundation.h"
export * module * { export * }
explicit module NSDebug { header "NSDebug.h" export * } }
![Page 130: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/130.jpg)
// Module Map - Foundation.framework/Modules/module.modulemap
framework module Foundation [extern_c] [system] { umbrella header "Foundation.h"
export * module * { export * }
explicit module NSDebug { header "NSDebug.h" export * } }
![Page 131: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/131.jpg)
// Foundation.h
… #import <Foundation/NSScanner.h> #import <Foundation/NSSet.h> #import <Foundation/NSSortDescriptor.h> #import <Foundation/NSStream.h> #import <Foundation/NSString.h> #import <Foundation/NSTextCheckingResult.h> #import <Foundation/NSThread.h> #import <Foundation/NSTimeZone.h> …
![Page 132: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/132.jpg)
// Foundation.h
… #import <Foundation/NSScanner.h> #import <Foundation/NSSet.h> #import <Foundation/NSSortDescriptor.h> #import <Foundation/NSStream.h> #import <Foundation/NSString.h> #import <Foundation/NSTextCheckingResult.h> #import <Foundation/NSThread.h> #import <Foundation/NSTimeZone.h> …
![Page 133: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/133.jpg)
Building the Module
Foundation
![Page 134: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/134.jpg)
Building the Module
CoreFoundation Security ObjectiveC Darwin …
Foundation
![Page 135: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/135.jpg)
Building the Module
Foundation
ObjectiveC Darwin
…SecurityCoreFoundation
![Page 136: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/136.jpg)
Building the Module
Foundation
ObjectiveC Darwin
…SecurityCoreFoundation
![Page 137: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/137.jpg)
Module Cache
$ clang -fmodules —DENABLE_CHINCHILLA=1 …
![Page 138: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/138.jpg)
Module Cache
$ clang -fmodules —DENABLE_CHINCHILLA=1 …
98XN8P5QH5OQ/ CoreFoundation-2A5I5R2968COJ.pcm Security-1A229VWPAK67R.pcm Foundation-1RDF848B47PF4.pcm
![Page 139: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/139.jpg)
Module Cache
$ clang -fmodules —DENABLE_CHINCHILLA=1 …
98XN8P5QH5OQ/ CoreFoundation-2A5I5R2968COJ.pcm Security-1A229VWPAK67R.pcm Foundation-1RDF848B47PF4.pcm
$ clang -fmodules —DENABLE_CAT=1 …
![Page 140: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/140.jpg)
Module Cache
$ clang -fmodules —DENABLE_CHINCHILLA=1 …
98XN8P5QH5OQ/ CoreFoundation-2A5I5R2968COJ.pcm Security-1A229VWPAK67R.pcm Foundation-1RDF848B47PF4.pcm
1GYDULU5XJRF/ CoreFoundation-2A5I5R2968COJ.pcm Security-1A229VWPAK67R.pcm Foundation-1RDF848B47PF4.pcm
$ clang -fmodules —DENABLE_CAT=1 …
![Page 141: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/141.jpg)
// // NorwegianCat.h // PetKit //
#import <PetKit/Cat.h>
NS_ASSUME_NONNULL_BEGIN @interface NorwegianCat: Cat ... @end NS_ASSUME_NONNULL_END
How Do We Find Our Cat… Again? This time with Clang Modules
![Page 142: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/142.jpg)
PetWall/ PetKit/ Cat/ Cat.h Cat.mm ... Info.plist Pet.h Pet.m PetKit.h
PetWall Project Directory
![Page 143: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/143.jpg)
PetWall/ PetKit/ Cat/ Cat.h Cat.mm ... Info.plist Pet.h Pet.m PetKit.h
PetKit.framework/ Headers/ Cat.h PetKit.h ... Modules/ module.modulemap
Clang’s Virtual File System (VFS)
![Page 144: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/144.jpg)
PetWall/ PetKit/ Cat/ Cat.h Cat.mm ... Info.plist Pet.h Pet.m PetKit.h
PetKit.framework/ Headers/ Cat.h PetKit.h ... Modules/ module.modulemap
Clang’s Virtual File System (VFS)
![Page 145: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/145.jpg)
Potential Modules Pitfalls
#import <PetKit/PetKit.h>#import “Cat.h”
![Page 146: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/146.jpg)
Potential Modules Pitfalls
#import <PetKit/PetKit.h>#import “Cat.h”
#define ENABLE_CUTE_KITTENS 1
![Page 147: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/147.jpg)
Potential Modules Pitfalls
#import <PetKit/PetKit.h>#import <PetKit/Cat.h>
#define ENABLE_CUTE_KITTENS 1
![Page 148: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/148.jpg)
Devin Coughlin, Program Analysis Team
•Behind the Scenes of the Xcode •Build Process: Swift Builds •
![Page 149: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/149.jpg)
![Page 150: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/150.jpg)
Recap: Clang Uses Headers to Find Declarations
.o
.m
.h
clang.m
.o
linker
clang
![Page 151: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/151.jpg)
Recap: Clang Uses Headers to Find Declarations
.o
.m
.h
clang.m
.o
linker
clang
![Page 152: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/152.jpg)
Swift Does Not Have Headers
Easier for beginners to get started
Avoids repeating declarations in separate file
Compiler does book-keeping to find declarations
![Page 153: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/153.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
![Page 154: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/154.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
#import "PetWall-Swift.h" @implementation AppDelegate … @end
![Page 155: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/155.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall class TestPetViewController: XCTestCase { }
#import "PetWall-Swift.h" @implementation AppDelegate … @end
![Page 156: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/156.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall class TestPetViewController: XCTestCase { }
#import "PetWall-Swift.h" @implementation AppDelegate … @end
Finding declarations
![Page 157: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/157.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall class TestPetViewController: XCTestCase { }
#import "PetWall-Swift.h" @implementation AppDelegate … @end
Finding declarations• Within a Swift target
![Page 158: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/158.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall class TestPetViewController: XCTestCase { }
#import "PetWall-Swift.h" @implementation AppDelegate … @end
Finding declarations• Within a Swift target• From Objective-C
![Page 159: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/159.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall class TestPetViewController: XCTestCase { }
#import "PetWall-Swift.h" @implementation AppDelegate … @end
Finding declarations• Within a Swift target• From Objective-C
Generating interfaces
![Page 160: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/160.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall class TestPetViewController: XCTestCase { }
#import "PetWall-Swift.h" @implementation AppDelegate … @end
Finding declarations• Within a Swift target• From Objective-C
Generating interfaces• To use in Objective-C
![Page 161: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/161.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall class TestPetViewController: XCTestCase { }
#import "PetWall-Swift.h" @implementation AppDelegate … @end
Finding declarations• Within a Swift target• From Objective-C
Generating interfaces• To use in Objective-C• To use in other Swift targets
![Page 162: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/162.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall class TestPetViewController: XCTestCase { }
#import "PetWall-Swift.h" @implementation AppDelegate … @end
Finding declarations• Within a Swift target• From Objective-C
Generating interfaces• To use in Objective-C• To use in other Swift targets
![Page 163: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/163.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
Finding Declarations Within a Swift Target
![Page 164: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/164.jpg)
Finding Declarations Within a Swift Target
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
![Page 165: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/165.jpg)
Finding Declarations Within a Swift Target
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
PetViewController.swift
![Page 166: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/166.jpg)
Finding Declarations Within a Swift Target
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
PetViewController.swift
![Page 167: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/167.jpg)
Finding Declarations Within a Swift Target
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
PetViewController.swift
class PetView: UIView { init(name: String, frame: CGRect) { self.name = name super.init(frame: frame) } }
PetView.swiftLoad and parse file
![Page 168: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/168.jpg)
Finding Declarations Within a Swift Target
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
PetViewController.swift
class PetView: UIView { init(name: String, frame: CGRect) { self.name = name super.init(frame: frame) } }
PetView.swiftLoad and parse file
Does not check types in bodies
![Page 169: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/169.jpg)
Compiler Looks at All Files Within Target
swiftc.swift .o
![Page 170: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/170.jpg)
Compiler Looks at All Files Within Target
swiftc
.swift
.swift
.swift
.o
![Page 171: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/171.jpg)
Xcode 9: Repeated Work in Debug Builds
Compiled each file separately
Enabled parallel, incremental compilation
Compiler had to repeatedly parse all files to find declarations
swiftc.swift .o
swiftc.swift .o
swiftc.swift .o
![Page 172: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/172.jpg)
Xcode 9: Repeated Work in Debug Builds
Compiled each file separately
Enabled parallel, incremental compilation
Compiler had to repeatedly parse all files to find declarations
swiftc.swift .o
swiftc.swift .o
swiftc.swift .o
![Page 173: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/173.jpg)
Xcode 10: More Sharing in Debug Builds
Group multiple files into common compilation process per core
Shares work of parsing within a process
Only repeat parsing across processes
NEW
swiftc.swift .o
.swift
swiftc.swift .o
Group 1
Group 2
![Page 174: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/174.jpg)
Xcode 10: More Sharing in Debug Builds
Group multiple files into common compilation process per core
Shares work of parsing within a process
Only repeat parsing across processes
NEW
swiftc.swift .o
.swift
swiftc.swift .o
Group 1
Group 2
![Page 175: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/175.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall class TestPetViewController: XCTestCase { }
#import "PetWall-Swift.h" @implementation AppDelegate … @end
Generating interfaces • To use in Objective-C • To use in other Swift targets
Finding declarations• Within a Swift target• From Objective-C
![Page 176: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/176.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
Finding Declarations from Objective-C
![Page 177: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/177.jpg)
Compiler Uses Clang as a Library to Import Objective-C
Avoids messiness of a foreign-function interface
Can import clang frameworks directly
swiftc
clang
![Page 178: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/178.jpg)
Objective-C Declarations Come from Headers
![Page 179: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/179.jpg)
Objective-C Declarations Come from Headers
Imported Objective-C frameworks: • From headers exposed in Clang module map
![Page 180: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/180.jpg)
Objective-C Declarations Come from Headers
Imported Objective-C frameworks: • From headers exposed in Clang module map
Within frameworks that mix Swift and Objective-C: • From the umbrella header
![Page 181: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/181.jpg)
Objective-C Declarations Come from Headers
Imported Objective-C frameworks: • From headers exposed in Clang module map
Within frameworks that mix Swift and Objective-C: • From the umbrella header
Within applications and unit test bundles: • From target’s bridging header
![Page 182: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/182.jpg)
Clang Importer Makes Methods More “Swifty”
- (BOOL)validateCuteness:(nonnull Pet *)pet error:(NSError **)err;
do { try validateCuteness(fluffy) } catch let e { … }
Objective-C Swift
![Page 183: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/183.jpg)
Clang Importer Makes Methods More “Swifty”
- (BOOL)validateCuteness:(nonnull Pet *)pet error:(NSError **)err;
do { try validateCuteness(fluffy) } catch let e { … }
Objective-C Swift
![Page 184: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/184.jpg)
Rename Methods Based on Part of Speech
Objective-C Swift
- (void)drawPet:(nonnull Pet *)pet atPoint:(CGPoint)point;
draw(fluffy, at: origin)
Drops parameter type names following verbs and prepositions
![Page 185: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/185.jpg)
Rename Methods Based on Part of Speech
Objective-C Swift
- (void)drawPet:(nonnull Pet *)pet atPoint:(CGPoint)point;
draw(fluffy, at: origin)
Drops parameter type names following verbs and prepositions
![Page 186: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/186.jpg)
Rename Methods Based on Part of Speech
Objective-C Swift
- (void)drawPet:(nonnull Pet *)pet atPoint:(CGPoint)point;
draw(fluffy, at: origin)
Drops parameter type names following verbs and prepositions
![Page 187: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/187.jpg)
Rename Methods Based on Part of Speech
Objective-C Swift
- (void)drawPet:(nonnull Pet *)pet atPoint:(CGPoint)point;
draw(fluffy, at: origin)
Drops parameter type names following verbs and prepositions
![Page 188: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/188.jpg)
// https://github.com/apple/swift/blob/master/lib/Basic/PartsOfSpeech.def ... VERB(extend) VERB(face) VERB(fade) VERB(fail) VERB(fancy) VERB(fasten) VERB(fax) VERB(fear) VERB(feel) VERB(fence) VERB(fetch) VERB(fight) VERB(fill) VERB(film) ...
![Page 189: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/189.jpg)
… But It Is Just a List
- (void)feedPet:(nonnull Pet *)petfeedPet(fluffy)
Objective-C Swift
Not renamed because ‘feed’ not in list
Use NS_SWIFT_NAME to change imported name explicitly
;
![Page 190: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/190.jpg)
… But It Is Just a List
- (void)feedPet:(nonnull Pet *)petfeed(fluffy)
Objective-C Swift
Not renamed because ‘feed’ not in list
Use NS_SWIFT_NAME to change imported name explicitly
NS_SWIFT_NAME(feed(_:));
![Page 191: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/191.jpg)
Xcode Shows Imported Swift Interface
![Page 192: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/192.jpg)
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall class TestPetViewController: XCTestCase { }
#import "PetWall-Swift.h"
Finding declarations• Within a Swift target• From Objective-C
@implementation AppDelegate … @end
Generating interfaces• To use in Objective-C• To use in other Swift targets
![Page 193: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/193.jpg)
#import "PetWall-Swift.h"
Generating Interfaces to Use in Objective-C
![Page 194: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/194.jpg)
Generating Interfaces to Use in Objective-C
#import "PetWall-Swift.h"
![Page 195: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/195.jpg)
Generating Interfaces to Use in Objective-C
class PetCollar: NSObject { @objc var color: UIColor = .blue var name: String = "Fido" }
Write in Swift:
#import "PetWall-Swift.h"
![Page 196: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/196.jpg)
Generating Interfaces to Use in Objective-C
class PetCollar: NSObject { @objc var color: UIColor = .blue var name: String = "Fido" }
Write in Swift:
Use from Objective-C:
#import "PetWall-Swift.h"
- (void)resetCollarColor { self.collar.color = [UIColor redColor]; }
![Page 197: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/197.jpg)
Compiler Generates Objective-C Header
class PetCollar: NSObject { @objc var color: UIColor = .blue var name: String = "Fido" }
Swift
![Page 198: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/198.jpg)
Compiler Generates Objective-C Header
SWIFT_CLASS("_TtC7PetWall9PetCollar") @interface PetCollar: NSObject @property (nonatomic, strong) UIColor * _Nonnull color; - (nonnull instancetype)init; @end
class PetCollar: NSObject { @objc var color: UIColor = .blue var name: String = "Fido" }
Swift Generated Objective-C Header
For classes extending NSObject and methods/properties marked @objc
![Page 199: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/199.jpg)
Compiler Generates Objective-C Header
SWIFT_CLASS("_TtC7PetWall9PetCollar") @interface PetCollar: NSObject @property (nonatomic, strong) UIColor * _Nonnull color; - (nonnull instancetype)init; @end
class PetCollar: NSObject { @objc var color: UIColor = .blue var name: String = "Fido" }
Swift Generated Objective-C Header
For classes extending NSObject and methods/properties marked @objc
Apps and unit tests: both public and internal declarations
![Page 200: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/200.jpg)
Compiler Generates Objective-C Header
SWIFT_CLASS("_TtC7PetWall9PetCollar") @interface PetCollar: NSObject @property (nonatomic, strong) UIColor * _Nonnull color; - (nonnull instancetype)init; @end
class PetCollar: NSObject { @objc var color: UIColor = .blue var name: String = "Fido" }
Swift Generated Objective-C Header
For classes extending NSObject and methods/properties marked @objc
Apps and unit tests: both public and internal declarations
Frameworks: Only public declarations
![Page 201: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/201.jpg)
Changing the Class Name in Objective-C
Compiler ties Objective-C class to mangled Swift class name
Prevents conflict when two modules define class with same name
class PetCollar: NSObject { @objc var color: UIColor = .blue var name: String = "Fido" }
Swift
@interface @property (nonatomic, strong) UIColor * _Nonnull color; - (nonnull instancetype)init; @end
Generated Objective-C Header
SWIFT_CLASS("_TtC7PetWall9PetCollar")PetCollar : NSObject
![Page 202: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/202.jpg)
Changing the Class Name in Objective-C
Compiler ties Objective-C class to mangled Swift class name
Prevents conflict when two modules define class with same name
class PetCollar: NSObject { @objc var color: UIColor = .blue var name: String = "Fido" }
Swift
@interface @property (nonatomic, strong) UIColor * _Nonnull color; - (nonnull instancetype)init; @end
Generated Objective-C Header
SWIFT_CLASS("_TtC7PetWall9PetCollar")PetCollar : NSObject
![Page 203: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/203.jpg)
Changing the Class Name in Objective-C
Compiler ties Objective-C class to mangled Swift class name
Prevents conflict when two modules define class with same name
class PetCollar: NSObject { @objc var color: UIColor = .blue var name: String = "Fido" }
Swift
Use @objc(Name) to provide custom name — but must not conflict!
@interface @property (nonatomic, strong) UIColor * _Nonnull color; - (nonnull instancetype)init; @end
Generated Objective-C Header
SWIFT_CLASS("_TtC7PetWall9PetCollar")PetCollar : NSObject
![Page 204: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/204.jpg)
Changing the Class Name in Objective-C
Compiler ties Objective-C class to mangled Swift class name
Prevents conflict when two modules define class with same name
class PetCollar: NSObject { @objc var color: UIColor = .blue var name: String = "Fido" }
Swift
@objc(PWLPetCollar)
Use @objc(Name) to provide custom name — but must not conflict!
@interface @property (nonatomic, strong) UIColor * _Nonnull color; - (nonnull instancetype)init; @end
Generated Objective-C Header
PWLPetCollar : NSObject SWIFT_CLASS_NAMED(“PetCollar")
![Page 205: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/205.jpg)
A
UNITIDENTIFIER
import UIKit class PetViewController: UIViewController { var view = PetView(name: "Fido", frame: frame) … }
@testable import PetWall
#import "PetWall-Swift.h"
Finding declarations• Within a Swift target• From Objective-C
@implementation AppDelegate … @end
Generating interfaces• To use in Objective-C• To use in other Swift targets
class TestPetViewController: XCTestCase {
}
![Page 206: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/206.jpg)
A
UNITIDENTIFIER
Must first import other modules to see their declarations
Can import Clang modules
In Xcode each Swift target produces a separate module
@testable import PetWallclass TestPetViewController: XCTestCase {
Module: A Distributable Unit of Declarations
}
![Page 207: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/207.jpg)
A
UNITIDENTIFIER
Must first import other modules to see their declarations
Can import Clang modules
In Xcode each Swift target produces a separate module
import XCTest
func testInitialPet() { let controller = PetViewController() XCTAssertEqual(controller.view.name, "Fido") }
@testable import PetWallclass TestPetViewController: XCTestCase {
Module: A Distributable Unit of Declarations
}
![Page 208: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/208.jpg)
A
UNITIDENTIFIER
Must first import other modules to see their declarations
Can import Clang modules
In Xcode each Swift target produces a separate module
import XCTest
func testInitialPet() { let controller = PetViewController() XCTAssertEqual(controller.view.name, "Fido") }
@testable import PetWallclass TestPetViewController: XCTestCase {
Module: A Distributable Unit of Declarations
}
![Page 209: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/209.jpg)
A
UNITIDENTIFIER
Must first import other modules to see their declarations
Can import Clang modules
In Xcode each Swift target produces a separate module
import XCTest
func testInitialPet() { let controller = PetViewController() XCTAssertEqual(controller.view.name, "Fido") }
@testable import PetWallclass TestPetViewController: XCTestCase {
Module: A Distributable Unit of Declarations
}
![Page 210: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/210.jpg)
A
UNITIDENTIFIER
Importing Swift Declarations from Other Modules
import XCTest @testable import PetWall class TestPetViewController: XCTestCase { func testInitialPet() { let controller = PetViewController() XCTAssertEqual(controller.view.name, "Fido") } }
![Page 211: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/211.jpg)
A
UNITIDENTIFIER
Importing Swift Declarations from Other Modules
import XCTest @testable import PetWall class TestPetViewController: XCTestCase { func testInitialPet() { let controller = PetViewController() XCTAssertEqual(controller.view.name, "Fido") } }
Deserialize to check typesPetWall.swiftmodule
PetViewController:
view: PetView
init() rename: () -> Void = { … } printDescription: () -> Void
![Page 212: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/212.jpg)
Expose Declarations to Other Modules via .swiftmodule
Serialized, binary representation of module’s declarations
Includes bodies of inlinable functions
Includes private declarations for debugging
public class PetViewController { public let view = PetView()
@inlinable public func rename() { view.name = "Fido" } private func printDescription() { … } }
PetWall.swiftmodule PetViewController:
view: PetView
init() rename: () -> Void = { … } printDescription: () -> Void
Serialize
![Page 213: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/213.jpg)
Produced During Compilation and Merged
.swift
.swift
swiftc
swiftc
.o
.o
![Page 214: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/214.jpg)
Produced During Compilation and Merged
.swift
.swift
swiftc
swiftc
.o
.o
.swift module
.swift module
![Page 215: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/215.jpg)
Produced During Compilation and Merged
.swift
.swift
swiftc
swiftc
.o
.o
.swift module
.swift module
swiftc .swift module
![Page 216: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/216.jpg)
Produced During Compilation and Merged
Generated Objective-C
Header
.swift
.swift
swiftc
swiftc
.o
.o
.swift module
.swift module
swiftc .swift module
.h
![Page 217: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/217.jpg)
Louis Gerbarg, Linker Team
•Behind the Scenes of the Xcode •Build Process: Linking
![Page 218: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/218.jpg)
![Page 219: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/219.jpg)
•What does the linker actually do? •What are symbols? •What are object files? •What are libraries?
![Page 220: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/220.jpg)
The Linker
![Page 221: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/221.jpg)
The Linker
Final task in building an executable Mach-O
![Page 222: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/222.jpg)
The Linker
Final task in building an executable Mach-O
Combines the output of all compiler invocations into a single file
![Page 223: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/223.jpg)
The Linker
Final task in building an executable Mach-O
Combines the output of all compiler invocations into a single file• Moves and patches code generated by the compilers
![Page 224: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/224.jpg)
The Linker
Final task in building an executable Mach-O
Combines the output of all compiler invocations into a single file• Moves and patches code generated by the compilers
Takes two kinds of input files
![Page 225: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/225.jpg)
The Linker
Final task in building an executable Mach-O
Combines the output of all compiler invocations into a single file• Moves and patches code generated by the compilers
Takes two kinds of input files• Object files (.o)
![Page 226: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/226.jpg)
The Linker
Final task in building an executable Mach-O
Combines the output of all compiler invocations into a single file• Moves and patches code generated by the compilers
Takes two kinds of input files• Object files (.o)• Libraries (.dylib, .tbd, .a)
![Page 227: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/227.jpg)
Symbols
![Page 228: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/228.jpg)
Symbols
A symbol is a name for a fragment of code or data
![Page 229: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/229.jpg)
Symbols
A symbol is a name for a fragment of code or data
Fragments of code may reference other symbols
![Page 230: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/230.jpg)
Symbols
A symbol is a name for a fragment of code or data
Fragments of code may reference other symbols
Symbols can have attributes on them that alter the linker’s behavior
![Page 231: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/231.jpg)
Symbols
A symbol is a name for a fragment of code or data
Fragments of code may reference other symbols
Symbols can have attributes on them that alter the linker’s behavior• Weak symbols
![Page 232: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/232.jpg)
Symbols
A symbol is a name for a fragment of code or data
Fragments of code may reference other symbols
Symbols can have attributes on them that alter the linker’s behavior• Weak symbols
Languages often encode data into a symbol “mangling” the symbol
![Page 233: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/233.jpg)
Object Files
![Page 234: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/234.jpg)
Object Files
Output of individual compiler actions
![Page 235: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/235.jpg)
Object Files
Output of individual compiler actions
A non-executable Mach-O file containing code and data fragments
![Page 236: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/236.jpg)
Object Files
Output of individual compiler actions
A non-executable Mach-O file containing code and data fragments• Each fragment is represented by a symbol
![Page 237: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/237.jpg)
Object Files
Output of individual compiler actions
A non-executable Mach-O file containing code and data fragments• Each fragment is represented by a symbol• Fragments may reference “undefined” symbols
![Page 238: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/238.jpg)
Libraries
![Page 239: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/239.jpg)
Libraries
Libraries define symbols that are not built as part of your target
![Page 240: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/240.jpg)
Libraries
Libraries define symbols that are not built as part of your target• Dylibs: Dynamic libraries
![Page 241: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/241.jpg)
Libraries
Libraries define symbols that are not built as part of your target• Dylibs: Dynamic libraries- Mach-O file that exposes code and data fragments executables can use
![Page 242: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/242.jpg)
Libraries
Libraries define symbols that are not built as part of your target• Dylibs: Dynamic libraries- Mach-O file that exposes code and data fragments executables can use
• TBDs: Text Based Dylib Stubs
![Page 243: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/243.jpg)
Libraries
Libraries define symbols that are not built as part of your target• Dylibs: Dynamic libraries- Mach-O file that exposes code and data fragments executables can use
• TBDs: Text Based Dylib Stubs- Only contains symbols
![Page 244: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/244.jpg)
Libraries
Libraries define symbols that are not built as part of your target• Dylibs: Dynamic libraries- Mach-O file that exposes code and data fragments executables can use
• TBDs: Text Based Dylib Stubs- Only contains symbols
• Static archives
![Page 245: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/245.jpg)
Libraries
Libraries define symbols that are not built as part of your target• Dylibs: Dynamic libraries- Mach-O file that exposes code and data fragments executables can use
• TBDs: Text Based Dylib Stubs- Only contains symbols
• Static archives- An archive of multiple .o files built with the “ar” tool
![Page 246: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/246.jpg)
Libraries
Libraries define symbols that are not built as part of your target• Dylibs: Dynamic libraries- Mach-O file that exposes code and data fragments executables can use
• TBDs: Text Based Dylib Stubs- Only contains symbols
• Static archives- An archive of multiple .o files built with the “ar” tool- Only the .o files with symbols you reference are included in your app
![Page 247: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/247.jpg)
Example
![Page 248: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/248.jpg)
// Cat.mm
extern void playSound(const char * file);
static const char * purrFile = “purr.aac”; @implementation Cat - (void) purr { playSound(purrFile); } @end
Example
![Page 249: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/249.jpg)
// Cat.mm
extern void playSound(const char * file);
static const char * purrFile = “purr.aac”; @implementation Cat - (void) purr { playSound(purrFile); } @end
Example
Cat.o l_.str: .asciz "purr.aac" "-[Cat purr]": adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
![Page 250: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/250.jpg)
// Cat.mm
extern void playSound(const char * file);
static const char * purrFile = “purr.aac”; @implementation Cat - (void) purr { playSound(purrFile); } @end
Example
Cat.o l_.str: .asciz "purr.aac" "-[Cat purr]": adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
![Page 251: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/251.jpg)
Example
// Cat.mm
extern void playSound(const char * file);
static const char * purrFile = “purr.aac”; @implementation Cat - (void) purr { playSound(purrFile); } @end
Cat.o l_.str: .asciz "purr.aac" "-[Cat purr]": adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
![Page 252: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/252.jpg)
Example
// Cat.mm
extern void playSound(const char * file);
static const char * purrFile = “purr.aac”; @implementation Cat - (void) purr { playSound(purrFile); } @end
Cat.o l_.str: .asciz "purr.aac" "-[Cat purr]": adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
![Page 253: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/253.jpg)
Example
// Cat.mm
extern void playSound(const char * file);
static const char * purrFile = “purr.aac”; @implementation Cat - (void) purr { playSound(purrFile); } @end
Cat.o l_.str: .asciz "purr.aac" "-[Cat purr]": adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
![Page 254: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/254.jpg)
Example
// Cat.mm
extern void playSound(const char * file);
static const char * purrFile = “purr.aac”; @implementation Cat - (void) purr { playSound(purrFile); } @end
Cat.o l_.str: .asciz "purr.aac" "-[Cat purr]": adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
![Page 255: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/255.jpg)
Example
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
![Page 256: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/256.jpg)
Example
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetKit
![Page 257: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/257.jpg)
Example
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetKit __TEXT
![Page 258: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/258.jpg)
Example
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetKit __TEXT
__cstring: .asciz "purr.aac"
-[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
![Page 259: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/259.jpg)
Example
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetKit __TEXT
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 260: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/260.jpg)
Example
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetKit __TEXT
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 261: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/261.jpg)
Example
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetKit __TEXT
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 262: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/262.jpg)
Example
PetSupport.a
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetKit __TEXT
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 263: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/263.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
PetKit __TEXT
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 264: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/264.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
PetKit __TEXT
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 265: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/265.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 266: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/266.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 267: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/267.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 268: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/268.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 269: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/269.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
libSystem.tbd --- archs: [ arm64 ] platform: ios install-name: libSystem.B.dylib exports: - archs: [ arm64 ] - symbols: [ ___open ] ...
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 270: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/270.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
libSystem.tbd --- archs: [ arm64 ] platform: ios install-name: libSystem.B.dylib exports: - archs: [ arm64 ] - symbols: [ ___open ] ...
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
_open$stub: ldr x16, _open$ptr br x16
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 271: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/271.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
libSystem.tbd --- archs: [ arm64 ] platform: ios install-name: libSystem.B.dylib exports: - archs: [ arm64 ] - symbols: [ ___open ] ...
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
_open$stub: ldr x16, _open$ptr br x16
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 272: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/272.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
libSystem.tbd --- archs: [ arm64 ] platform: ios install-name: libSystem.B.dylib exports: - archs: [ arm64 ] - symbols: [ ___open ] ...
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
_open$stub: ldr x16, _open$ptr br x16
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 273: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/273.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
libSystem.tbd --- archs: [ arm64 ] platform: ios install-name: libSystem.B.dylib exports: - archs: [ arm64 ] - symbols: [ ___open ] ...
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
_open$stub: ldr x16, _open$ptr br x16
__DATA Pointers
_open$ptr: .long 0x0
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 274: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/274.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
libSystem.tbd --- archs: [ arm64 ] platform: ios install-name: libSystem.B.dylib exports: - archs: [ arm64 ] - symbols: [ ___open ] ...
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
_open$stub: ldr x16, _open$ptr br x16
__DATA Pointers
_open$ptr: .long 0x0
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 275: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/275.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
libSystem.tbd --- archs: [ arm64 ] platform: ios install-name: libSystem.B.dylib exports: - archs: [ arm64 ] - symbols: [ ___open ] ...
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
_open$stub: ldr x16, _open$ptr br x16
__DATA Pointers
_open$ptr: .long 0x0
__LINKEDIT Bind _open$ptr -> libSystem`_open
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 276: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/276.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
libSystem.tbd --- archs: [ arm64 ] platform: ios install-name: libSystem.B.dylib exports: - archs: [ arm64 ] - symbols: [ ___open ] ...
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
_open$stub: ldr x16, _open$ptr br x16
__DATA Pointers
_open$ptr: .long 0x0
__LINKEDIT Bind _open$ptr -> libSystem`_open
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
![Page 277: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/277.jpg)
Example
PetSupport.aPetSounds.o
__Z9playSoundPKc: … bl _open
Cat.o l_.str: .asciz "purr.aac" -[Cat purr]: adrp x0, l_.str@PAGE add x0, x0, l_.str@PAGEOFF b __Z9playSoundPKc
PetCare.o _callVet: …
libSystem.tbd --- archs: [ arm64 ] platform: ios install-name: libSystem.B.dylib exports: - archs: [ arm64 ] - symbols: [ ___open ] ...
PetKit __TEXT
__Z9playSoundPKc: … bl _open$stub
_open$stub: ldr x16, _open$ptr br x16
__DATA Pointers
_open$ptr: .long 0x0
__LINKEDIT Bind _open$ptr -> libSystem`_open
__cstring: .asciz "purr.aac"
-[Cat purr]: adr x0, #0x6f4 nop b __Z9playSoundPKc
Optimizing App Startup Time WWDC 2016
![Page 278: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/278.jpg)
![Page 279: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/279.jpg)
![Page 280: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/280.jpg)
![Page 281: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/281.jpg)
![Page 282: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/282.jpg)
![Page 283: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/283.jpg)
Open Source
Swift • https://swift.org/
Clang • https://www.llvm.org/
llbuild • https://github.com/apple/swift-llbuild/
![Page 284: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/284.jpg)
More Informationhttps://developer.apple.com/wwdc18/415
![Page 285: 415 WWDC 2018 Behind the Scenes of the Xcode Build Process](https://reader036.vdocuments.net/reader036/viewer/2022072020/62d8027b5c6c2d20796a3e1e/html5/thumbnails/285.jpg)