Page 7 of 11

Creating App Custom URL Scheme Jul 17 2019

We can do this by adding the following fields to the info plist:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
	<key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeRole</key>
			<string>Viewer</string>
			<key>CFBundleURLName</key>
			<string>com.rderik.intoaccountapp</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>intoaccountapp</string>
			</array>
		</dict>
	</array>

Or by going to the project info and adding a new URL Type. Create new Custom URL Scheme

The scheme is the one you’ll use to reference the app. For example, when you want to open your app form a today extension, you will use a code similar to the following:

Read More...

Sharing information between iOS app and an extension Jul 16 2019

If you decided to create an Extension for your app (maybe a Today Extension), you will quickly find out that you need to access data from your main app. And soon after, you will find out that you can’t access files in your main app directly from the extension. The process is not as easy as you thought when you started. The good news is that there are a few solutions, and they are not that complicated. In this post, I’ll show you how to use App Groups and embedded frameworks to create the bridge between your app and the extension.

Read More...

UITableView notes Jul 14 2019

There are small details of UITableView that are simple but makes the table view look good. One of those is hiding the separator for empty cells.

A table view has a header, body and footer. Most of the time, when we start a project, we drag a table view but never define the header and footer of the table view, we only use the body. The problem with not having a footer is that the body of the table fills the container, so empty cell separator shows. If we add a footer, even if it is an empty view, this does not occur any more. Let’s first see how to do it via code.

Read More...

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

Using Ansible to automate local tasks and setup Jun 19 2019

We can use an automation tool like Ansible to configure servers, set up CI/CD pipelines, and many more DevOpsy tasks.

This same tool can be used to maintain the setup of our day to day environment (as suggested by my friend Gerardo Santoveña) or automate tasks. We can create playbooks that contain the instructions for completing tasks or defining the state you want your environment to have. In this post, I’ll show you Ansible’s basics. By the end of the article, you’ll have enough knowledge to start automating some of your everyday tasks or maybe even create a playbook to set up your environment.

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

$