Page 1 of 5
First, remember create a new branch for the changes, we can do that using Xcode or the git(1) command-line tool.
The basic support
iOS 13 introduced semantic colours, so UIKit already comes with support for automatic colour selection depending on the UserInterfaceStyle. So the simplest setup is to change our UIColor to semantic colours. For example:
Read More...
Hello, and welcome to issue #32!
How are you doing? I hope everything is going well wherever you are. Things seem to have been settling down around here, so I’ve got more time to write. I completed my guide on macOS network programming in Swift. It covers three main frameworks:
- BSD Sockets
- Apple’s Network.framework
- SwiftNIO
With that, you should be able to build a wide range of network applications in macOS. As always, my guides are “pay what you want”. Including $0.00, so they are free, but if you find them useful and want to support me, you can buy them. Networks is a topic I always found fascinating, it is at the core of the Internet. But network programming also touches other areas like security, system administration, software engineering, and telecommunications. So it is a broad topic, but super fun to explore. Have a look at the guide and build some network applications, I bet you’ll have fun.
Read More...
Hello, and welcome to issue #31!
I’m still amazed by how the Internet has become such a fundamental part of society. I wonder what the world will look like 100 years from now. And all of this runs on protocols created decades ago. It’s truly fascinating.
As you can tell, many of the posts I write are related to networks, and this week is no exception. I believe that we all have some responsibility to try to make the world a better place, and we, as technology enthusiasts, can make it better by building the infrastructure for future communication. So maybe I can give back by teaching what I’ve learned about networks. Hopefully, all of us can be part of building a better future.
Read More...
Building a network application requires a good amount of effort, not only because of the complexities of the application you are building but also by the nature of network architecture. We have to define how are we going to handle the connections, the abstractions we’ll use to differentiate between network code and our application code, etcetera. Here is where SwiftNIO comes in, it provides an efficient non-blocking event-driven model, that is easy to use and extend. If we follow SwiftNIO’s model, we can take a lot of the boilerplate set up away and focus on building the logic of our applications. In this post, I’ll show you how to use SwiftNIO and understand its workflow by creating a server that receives text from clients and returns a modified version of the text.
Read More...
The ncurses(3) library powers many popular text-based applications, for example, emacs(1) and htop(1). The use of ncurses is not required to build text-based applications. We could use escape sequences. And for small command-line tools escape sequences are enough, but sometimes it’s nice to rely on a library that handles edge cases. In this post, we’ll build a text-based clock that uses SwiftCursesTerm, a wrapper library I created for using ncurses in Swift.
Read More...
Hello, and welcome to issue #30!
Sometimes I feel a little nostalgic of the “good old days” when the command-line received so much love. I still believe that it is the most useful tool if you want to increase your productivity. Using graphical interfaces feel sluggish compared to a fine-tuned terminal interface. Typing is faster than moving the mouse across the screen, especially if you have a big monitor. So when everyone is so excited about SwiftUI or React, or any other graphical interface framework, I go back to working on the command-line.
Read More...
Hello, and welcome to issue #29!
I hope you are well where ever you are. These are weird times we live in, a lot of terrible news around the globe. But that doesn’t mean that we can’t make it better. Make sure you help improve your little part of the world, sometimes small gestures have a big impact on people’s lives (including our own).
These last few weeks, I’ve been busy working on a few open-source projects, trying to give back to the world of open-source. And having a good time doing it. The following are some of the project’s I’ve been contributing to. And a tool I’ve open-sourced for everyone to use:
Read More...
Shoulder surfing is a real threat. And we, as software developers, should strive to provide safety to our users. One way to mitigate the inadvertent exposure of sensitive data is related to how we handle the input of sensitive data in our applications. Every time the user inputs sensitive data, we should hide it from prying eyes. In this post, we’ll learn how to read passwords and passphrases on a command-line tool built using Swift.
Read More...
Hello, and welcome to issue #28!
I’ve been working with computers for most of my life, and especially on *nix systems. It always surprises me how much there is to learn. It’s always interesting to read about the history of some part of the OS that you thought you understood, and learn something new. That happened when I was reading the following article:
Tales From a Core File - Lessons from the Unix stdio ABI: 40 Years Later
Read More...
Operating systems have provided command-line interfaces for decades now, and all but the simplest command-line tools require argument parsing. Due to years of use and refinement, there are many expectations on how command-line tools should handle arguments. Because of these popular conventions, creating an argument parser is not as simple as we might think.
Creating a bespoke argument parser might not be where we would like to spend most of our time. The good news is that you don’t have to, Apple open-sourced the Swift Argument Parser (SAP). In this post, we’ll learn how the Swift Argument Parser works, and how to use it for handling STDIN for composable command-line tools.
Read More...