How Do Binaries work together? What breaks ABI?

For two (dynamic) libraries to work together they need: API compatibility ABI compatibility If you have correct function, parameter names, and are able to access it (it’s not private) then you’re good. The compiler validates if classA is using the correct Programming Interface from classB 👈 API (Application Programming Interface) Example of API usage struct House { var address = Address(streetAddress: "1100 Happy St.") } struct Person { var address = Address("1100 Sad St.") // ‼️ Missing argument label 'streetAddress:' in call } struct Address { let streetAddress: String } ABI compatibility is similar to API, but just at the binary level. The compiler is no longer involved. What’s involved is the dynamic linker dyld. ...

⚡️ SERIES - Optimizing App Size

The series summarizes a six month journey where I learned a lot about compiler, linker, different kinds of linking, debug symbols, dSYM, xcframeworks, stripping, build settings, swiftc and more.

Difference between an app bundle and a binary

Whats the Difference Between an App (bundle) and a Binary

A binary is the final product from linking all your source code. It’s executable. You can run commands against it. An app, is merely a wrapper / directory, which includes that binary and other things. How do you create a binary? First it’s important to understand what a binary is. You’ve used them every day in the terminal. Examples: ls, cp, mkdir. You pass certain parameters to them. They don’t have any file extension. They’re in machine code i.e. zeros and ones. With some simplification, this is how we create a binary from our source code: ...

How cp case-insensitivity can cause chaos!

Been doing Advent of Code in the last couple of days. I completed Day 6. I have been doing it from an Xcode project. However I was thinking it would be nice if I could do it from command line. So I started to do some code clean up. First I started with renaming the folder from AOC to aoc. I did: cp -r AOC aoc I saw a new aoc directory created. I was happy. It was easy. Or at least it seemed easy. I went back to my AOC directory. I noticed a whole bunch of changes that I didn’t make. Confused! I tried figuring it out. I couldn’t. Decided to remove the changes with: ...

Why does pod lib lint suddenly fail to build?

I made some changes to the repo of our private pod. Pushed up my branch. Tests all ran. Then my colleague asked for some updates to my PR (pull request). I made changes and pushed it to GH. I wanted to merge the changes. But then CI was failing. So I ran CI again. It failed again. They say third time is the charm. So I ran it two more times. It still failed. I thought I had changed something in the project file, because I was getting some Swift compatibility error. I erased the derived data and clean build. I was able to build and run all tests. I wasn’t sure why things were still failing. ...

self-contained rv

What is a Self Contained Build Script?

So I had this need to add a brew package named gh into our build script. I spoke with with the team that handled our agents and asked them to add a new package on the agents. I was told that the package has to be included as part of the build script and that build scripts need to be self-contained. At first I didn’t fully understand what ‘self-contained’ means in this context but as I digged more into our Jenkinsfile I learned what it meant. First let’s figure out: ...

git cherry-pick

How to cherry-pick a library fix?

I’ve done this so many times, but every time I do it with hesitance. It’s usually because I’m not certain I’m finding the right commit or if I’m applying it the right way. These steps explain the process and how to validate that you’re doing thins the right way. Find out the library version that your release is using. Check out that version of your library. Create a new branch off that version. Find the SHA of the commits you want to cherry pick. Cherry pick them in and validate you’ve cherr-picked correctly. Make a new release/tag. Go back to your main app. Check out the release branch again. Create a new release version Update your Podfile (or whatever it is that you’re using) to pull the updated version. All the steps together ...

git branch synopsis

How to Read Git Documentation

I used to find it super hard to read git syntax. I didn’t know what what --, <>, [], ..., |, (), etc meant. Turns out, it’s a whole lot easier than you think. The synopsis contains a list of most likely forms you’d try. But sometimes the synopsis is just one big long synopsis where all the options are thrown in at once. This can make it hard to understand the different ways of using the options and commands. ...

Flight manifest

What is Manifest.lock File?

When you get on a plane, the crew members make sure everyone that checked in, is actually on the flight. If someone doesn’t board, then the plane either stays until they board or remove them and their luggages from the plane. It’s a safety check. CocoaPods does something similar. But before we dive deep into what a Manifest.lock file is, we should learn about the two schools of thoughts when it comes to dependencies. ...

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: ...