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.
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.
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
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_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
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
dlerror. Make sure if you can use these functions in your project.
leacks_cheker.cfile into your C project. Anywhere you want, just be sure you add to the build. …
For command line applications
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
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…
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.
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.
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.
Let’s create a library project first. Open Xcode and select
Cocoa Touch Static Library.
An experienced software engineer with over 15 years in mobile development. Interested in Swift, iOS, Java and music programming. Skydive as a hobby.