Page 2 of 2

Changing blog path in Middleman May 6 2020

I use Middleman as my Static Site Generator, I have two “blogs” in my site:

When I created the TIL blog I wanted it to be my repository of small notes for things I learned that day (hence the name Today I Learned).

Naming is important, and the TIL has prevented me from posting short pieces on my site because it’s not something I “learned today”. So I decided Notes would be a better name.

Read More...

My Xcode gitignore template Aug 28 2019

I would like to change the template Xcode uses to generate a git repository, but I haven’t found how. So at the moment when I want to use my .gitignore template I just pull it from a GIST.

This y my Xcode .gitignore template. I use the raw address and Curl to copy it.

1
$ curl -L https://gist.githubusercontent.com/rderik/8550f34a93beaf62aacc9ac7d746b69c/raw/.gitignore > .gitignore

And that’s it for the moment. If anyone knows how to change the git template Xcode uses let me know.

Read More...

Adding Fastlane to an Xcode project Aug 15 2019

We can install Fastlane as a Homebrew cask or as a gem. I’ll go the gem route.

add a Gemfile on your project:

1
2
3
4
#Gemfile
source "https://rubygems.org"

gem "fastlane"

We are going to use bundler. If you are familiar with Ruby development, you will find this standard procedure.

1
2
$ bundle update
$ bundle install

now we can run fastlane because we want to use the version we currently installed, we will run it:

Read More...

exportOptions properties Aug 13 2019

From the help obtained on

1
2
3
$ xcodebuild -version
# Xcode 10.3
# Build version 10G8

This are the options available for the exportOptins Property List file:

compileBitcode : Bool

For non-App Store exports, should Xcode re-compile the app from bitcode? Defaults to YES.

destination : String

Determines whether the app is exported locally or uploaded to Apple. Options are export or upload. The available options vary based on the selected distribution method. Defaults to export.

Read More...

Using Drag and Drop on UITableView for reorder Jul 26 2019

If we use custom cells for a UITableView, and we want to re-order using drag and drop, we need to make our cell model conform to NSItemProviderWriting, NSItemProviderReading and NSObject. To move an object using drag and drop, we need to to be able to serialize and deserialize it. Also, we need to have a drag/drop delegate. Usually, this could be our ViewController.

First, let’s set up our delegate.

UITableViewDragDelegate and UITalbeViewDropDelegate

If we are using our ViewController as the delegate for the drag and drop we need to conform to the protocols UITableViewDragDelegate and UITableViewDropDelegate. To comply with the protocols, we need the following methods:

Read More...

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

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

$