May 2021

Photo by seth schwiet on Unsplash

Many of us aggregate our code snippets and utilities to libraries. Several years ago, Apple provided a good package manager that might be used for this goal — Swift Package Manager (SPM). Undoubtedly SPM is a great tool, but sometimes developers face issues that are difficult to find the reason, and fixing may be tangled and not obvious.

In this short note, I would like to document a workaround for one of these issues.

It looks like:

It’s a short description of a learning task.

After we implemented several flags support, we may say that we have the first prototype of our application. Now we can draw a bottom line, analyze our experience, see what is done well, and improve.

Architecture specification

Our application at the moment is messy enough. At this stage it’s a good idea to split it in several modules and assign their responsibility.

Basic algorithm’s idea

The main idea to separate the application in two main parts — input error handling and ULS logic work. We will skip error handling for now and concentrate on the algorithm…

The place matters

Photo by Ramshid ekl on Unsplash

The main idea of this article is to describe an approach that gives an ability to find memory leaks in C code on macOS. It considers one of the possible options for finding memory leaks and represents a skeleton that may be extended if necessary.

In contrast to the previous article, this approach is not entirely POSIX compatible since it uses backtrace and backtrace_symbols functions that are not a part of the IEEE 1003.1 standard. So, if your operating system does not provide these functions, you should find alternatives on your own.

The approach was tested on…

An advanced way

Photo by Harrison Broadbent on Unsplash

In one of my previous articles, I wrote about finding memory leaks in C code on macOS. There is one more approach to do that. In comparison with the previous one, it’s easier to use and more reliable. It also may be used not only on macOS but on any POSIX compatible system.


This approach uses C function such as fprintf, dlsym and dlerror. Make sure if you can use these functions in your project.

Just do this

  1. Paste leacks_cheker.c file into your C project. Anywhere you want, just be sure you add to the build. …

For command line applications

Photo by Daan Mooij on Unsplash

Sometimes you may found yourself writing small programs on C/C++ on macOS. If you are a programmer, who cares about system resources you will probably want to know if your program loose pieces of memory. In other words, you may want to find memory leaks.

In 2020 macOS has a quietly powerful and handy tool to find memory leaks — leaks. For some reason, the documentation is not very clear in the first reading, and it may take some time to figure out what you have to do to make it work properly. In this short…

In god we trust — the rest we test

Photo by Chris Ried on Unsplash

It’s a very short and applicable piece about basics C code testing. It does not cover many topics and may look too simple for someone. But it gives an ability to write simple tests to them who are at the beginning of their software development way.


When you write your code, you have to be sure if it works correctly. You probably plenty of times found yourself changing your code, writing ,and deleting debugging lines, rerun your application a lot of times to be sure if your tiny change did not…

Let’s make our static library universal

Photo by Christopher Gower on Unsplash

The main idea this article considers is how to make a static library universal, meaning containing binary code that works across a simulator and a real device.

To know how to make a static library on Swift 5 from scratch , check out the first part of this tutorial.

Make the Library Universal

To follow this article, you may use the final project from the previous tutorial, or you can download the ready to use starter project from GitHub. There are two projects there. Open the one named Networking, which is the project we’ll use for a static library in this tutorial.

Add a new target: aggregator

First thing…

A simple and fast step-by-step tutorial

Photo by Fabian Grohs on Unsplash

In this article, we will consider creating a static library for Swift 5 and its integration to another project.

The article is mostly like a step-by-step how-to tutorial and does not cover a lot of theoretical and historical topics. It also does not aim to consider all the possible cases where static libraries can be used or created.

It’s just a short and basic tutorial to create your first Swift static library for an iOS application as simple and fast as possible.

Create Static Library Project

Let’s create a library project first. Open Xcode and select Cocoa Touch Static Library.

Rostyslav Druzhchenko

An experienced software engineer with over 15 years in mobile development. Interested in Swift, iOS, Java and music programming. Skydive as a hobby.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store