Page 4 of 5
There are many reasons to use more than one programming language in a project. In some cases, a lot of work has gone into building a framework (years maybe). Rewriting the whole framework to have the codebase in the same programming language, might not be the best use of resources. You can see this in macOS between the two main programming languages, Swift and Objective-C (three counting C). In this post, I’ll show how to use Swift code in Objective-C, and how to use Objective-C code in Swift. We are going to explore how the interoperability occurs by building the code manually to get a better understanding.
Read More...
Apple’s network APIs are many, the older APIs are well documented, and you’ll find lots of examples. Not so much about the new Network framework. One factor might be that the name is not that search-friendly. In this post, I’ll explain how to use the NWFramework by creating a basic TCP server-client application.
The server will work as an echo, any message received will be sent back to the client. The client will allow us to send messages to the server and display the server response.
Read More...
With advances in the frameworks and tools we use to develop software, creating a new app seems like magic. We just click a few buttons, and everything is created for us. I enjoy magic, but I think that sometimes we end up being Framework “users” without any real understanding of what is happening. In this post, I’ll explain a few concepts of how macOS apps work, so hopefully, we understand the ecosystem better.
Read More...
An essential step before you deliver your application to your users is to make sure that your app is not overusing your user’s resources. In this post, I’ll show how to use Xcode’s visual debugger and the command-line counterparts to check for common memory problems and also how to use Instrument’s to debug memory leaks.
First, let’s see which are the most common memory-related problems.
Memory issues
There are two common types of memory problems.
Read More...
Sometimes we only want to do the simplest of tasks of build and upload to TestFlight without having to spend much time doing lots of configuration. Maybe we are only testing a minimum viable product (MVP) and want to make it accessible to beta users. No matter the case, we also would like to understand the process behind the magic behind the graphic interface deployment. In this post, I’ll show the basic process of building and uploading an app to the Apps Store Connect(especially for TestFlight) using the command-line. And also, how can we automate it with a simple script and the tools already provided by Xcode.
Read More...
Building a command-line interface (CLI) tools is a complicated task. We work on the logic of our application and also have to deal with other details like parsing parameters, handling the correct display directives depending on the TTY, etcetera. Vapor, the web framework, uses a module called Console (called ConsoleKit on V4) to build their CLI.
Vapor’s command-line tool provides a lot of functionality, and at the same time, it looks quite smooth. I would like my CLI tools to look more like their command-line tool.
Read More...
Swift is a powerful language. It can be used to create command-line tools, iOS apps, watch OS apps, macOS apps and server-side applications. However, sometimes, we only need to complete a small task, maybe do some automation on our local setup or build a simple script to process data and then send it to another tool. Using Swift for small tasks is what I want to share in this post, not how to build command-line interfaces (CLIs) but how to use the language you already know, Swift, and use it for scripting.
Read More...
Localization is not only translating content but adapting the content to culture, language and customs. This makes our apps more intuitive and engaging for our users. We can localize not only text, but we can also localize images, sounds, shortcuts, etcetera. A crucial part of localization is obtaining the text to be localized. In this post, I’ll focus on text extraction for localization. This post is not a general introduction to localization of apps, but when you finish reading the post, you’ll have a better understanding of crucial aspects of localization and can research other specific topics that you are interested in. As always, check my notes at the end of the posts where I add links and notes to explore related topics, let’s begin.
Read More...
Accessing remote servers using passwords has been discouraged for a long time, and it is suggested to use SSH public keys as the authentication method. I’ve noticed that for some users, the setup and maintenance of their keys becomes a problem, so they go back to using passwords. In this post, I’ll explain how to use SSH keys to login to remote servers and how to set up your SSH configuration to keep track of your keys using the macOS keychain.
Read More...
In this post, I’ll explain how to figure out where macOS stores specific preferences and how to modify them using the command line tool defaults. Knowing where the preferences are stored and how to manage them programmatically allows us to create scripts that will help us automate the setup of one or many computers. I think you’ll find it useful.
I was sharing some code through Slack when I noticed that all my straight quotes (') were replaced by smart quotes (’). I felt cheated, I remember this happening in other apps before, but I’ve stopped myself in the past from fixing it because I don’t want to run after any premature-optimization or automation. The simple solution is to go to Settings > Keyboard > Text and deselect the “Use smart quotes and dashes” checkbox. But how and where do macOS stores user’s preferences?
Read More...