Page 5 of 7

Coordinator iOS Jul 12 2019

I am using the coordinator pattern on my Counter App. These are the steps to implement the coordinator pattern.

1. Create a Coordinator protocol.

1
2
3
4
5
6
7
import UIKit

protocol Coordinator {
    var navigationController: UINavigationController { get set }
    
    func start()
}

2. Create a class that implements the Protocol

I normally use AppCoordinator.swift:

Read More...

Text extraction tools for macOS and iOS app localization Jul 10 2019

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

Understanding SSH Keys and using Keychain to manage passphrase on macOS Jul 3 2019

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

Tracking where settings are stored on macOS Jun 28 2019

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

Xcode code structure - matching groups and filesystem May 24 2019

A folder structure makes it easy to navigate and understand any project. On Xcode, we can build the project structure using groups. The problem with this is that it doesn’t reflect on the filesystem. What this means is that if we are looking at the code on the filesystem, or on Github, we won’t have the benefit of the project structure. In this post, I’ll explain how to share the project structure on the filesystem and on Xcode.

Read More...

Apple's Natural Language Framework basics - Status of Tibetan support Mar 11 2019

The Natural Language framework, introduced by Apple in 2018, provides tools for developers to process and analyse text. The framework provides the following capabilities:

I’m interested in Tibetan texts processing, so let us see how can we use this framework for Tibetan Text processing.

Language and script identification

Identifying language and script is a simple matter of providing some text and asking the Natural Language framework (NL from now on) to identify the language. We can do this in two different ways; one is straight forward using NLLanguageRecognizer, the second one is using NLTagger setting up the tagScheme to obtain the language. The following code uses NLLanguageRecognizer:

Read More...

Using ICU transforms in Swift Feb 28 2019

The International Components for UnicodeICU provides powerful libraries for working with Unicode. In this post, I’ll explain the basics of how to use ICU transforms in Swift. There are many areas to explore in ICU and Swift, but we will focus on using the transforms defined in ICU User Guide. There is currently no support for arbitrary ICU transforms, but the basics are handy.

In a future post I will discuss the use of Unicode properties, in Swift 5 we will get Unicode properties added to Unicode.Scalar and that will give us access to more ways to get information on what our Strings represent and create software that handles better the use of different scripts and languages. But for now, let’s focus on ICU transforms.

Read More...

What is AppDelegate for in iOS? Jan 23 2019

Each app in iOS has only one UIApplication object in charge of managing the app when your app changes state in its life cycle(e.g. activate, suspend, send to background, reactivate, etc.) it notifies it’s AppDelegate so it can run any task required by that change in state. In simple terms, the AppDelegate is in charge of ensuring that your app state changes are handled correctly, that the app is ready for each state change and will end up in a valid state when the event takes place.

Read More...

Setup Swift LSP and Vim Jan 22 2019

With the release of SourceKit-LSP we can run an LSP server for the Swift programming language. That means that we can take advantage of autocompletion and jump to the definition in our text editors that support connection to an LSP server. I’ll show how to set this up using Vim 8.

LAST UPDATED: September/25/2019

First install SourceKit-LSP

Clone the source from the SourceKit-LSP repository

Read More...

iPad multitasking and StackView Jan 3 2019

To make the user experience better on iPad for multitasking remember that you can change the axis of your StackViews depending on the size class of your view or view controller.

Size Class

Size classes represent the relative space of the view or view controller on the device. There are two size classes, compact and regular, this means Compact has limited space and Regular has the regular/normal space. So this is how it looks for iPhone and iPad

Read More...

$