Optimizing Binaries - Build Pipeline Jargon

To understand this post, I highly recommend everyone to watch the WWDC 2022 - Link fast: Improve build and launch times and WWDC 2018 - Behind the Scenes of the Xcode Build Process. They’re of the best talks I’ve ever seen. This post covers some of the jargon and how it all comes together. And even though I love making puzzles, I’ll justify why I picked it as my cover. Files .c: A source code file written in C programming language. .swift: A source code file written in Swift programming language. .o: A machine code interpretation of the source code. An intermediate file. Also known as an object file. Named as such, because it’s the object/goal of our source code. .h: A file that doesn’t contain implementation. But only the interface. .a: An archive file. Made up from multiple .o files. Also known as a Static Library or Archive. .dylib: A separate binary, from the main executable. Gets linked with the app’s executable at runtime. Gets copied into the app wrapper. As a result, the main executable is smaller and, because the code is loaded only when it is needed, the build time is typically faster. Also known as Dynamic Library. Often they also have an empty file type. : (commonly with empty file types). A binary. For the scope of our discussions our focus is mostly on dylibs or app executables. Binaries in the Apple world (OSX and iOS) usually don’t have a file type. They’re the end product, the program that gets ran/executed. As the name suggests it’s just 0s and 1s. It’s the lowest possible language level. You can’t get any lower than that. Some examples of an executable are: An iOS app’s main executable: An app you open on your iPhone, ends up calling the app’s executable. Example the Safari app on your iPhone has a Safari executable. Other Examples - macOS binaries: Some examples that you use in the command line are: ls, cp, mkdir, pwd . Every time you do ls, you’re calling a binary somewhere in your macos. Executables are also known as binaries. See docs on /bin. Also see the /bin directory below: If you do `which ls` then you'll get to see the path to the binary that is used .dSYM: In short, it’s a debug information file. For more see here ‘main app executable’: An app may have multiple executables. Examples of this happening: An iOS app that has app extensions. App extensions are also executable. But aren’t the main executable. A command line interface that has. Users won’t have to call your other executables. But your main app will likely call the other executables. ...

Optimizing Binaries - High Level Xcode Build Pipeline

This the first post of a series I’m doing on how to optimize your app’s binaries. The post is more of a high level intro. Depending on the action (build, run, test, profile, analyze, archive) of your scheme, the process will have all or some of the following steps: Dependency analysis What happens when you press build? So the first step is for the build system to take the build description, your Xcode project file. Parse it, take into account all the files in your project, your targets and the dependency relationships. Your build settings, and turn it into a tree-like structure called a directed graph. And this represents all the dependencies between the input and output files in your project and the tasks that will be executed to process them. Next the low-level execution engine processes this graph, looks at the dependency specifications and figures out which tasks to execute. The sequence or order in which they must be run and which tasks can be run in parallel. Then proceeds to execute them. From WWDC 2018 - Behind the Scenes of the Xcode Build Process 4:57 ...

What is UITransitionView about?

I was using Xcode’s View Hierarchy and noticed this UITransitionView in my view hierarchy. ... UIWindow UITransitionView FooVC UITransitionView BarVC This was odd because I was expected a view hierarchy as such: ... UIWindow UITransitionView FooVC BarVC What made it more perplexing was that the canvas was showing things correct, but the View Hierarchy didn’t make sense. To be clear on jargon, the following is the name of each section of Apple’s view debugger: ...

Why can't Xcode show the caller?

Edit Ever since I’ve upgraded to Xcode 16.1 I’ve experienced significant issues with finding callers. Yet aside from Xcode being broken, this post is still applicable for having a correct understanding of when / why / how Xcode should and shouldn’t work. Sample Project Download the sample project if you want. You don’t have to though. The project doesn’t even need to be ran. It’s just provided for context. I’m going to discuss two gotchas I hade with Xcode. For quite some time I thought a fix was coming, then I realized this is because I didn’t fully understand the difference between an interface (or protocol) with a concrete type. ...