Swift: Add Tap Gesture Recognizer to Custom UI Element
Swift: Add Tap Gesture Recognizer to Custom UI Element avatar

To recognize a touch or tap on a custom ui element programmatically in swift use the following schema:

Swift: If Statement with Optional Binding (let) and Logical AND
Swift: If Statement with Optional Binding (let) and Logical AND avatar

In Swift, you can use optional binding inside an if statement:

Furthermore, you can unwrap the optional inside the same if statement and add a logical AND using the where clause:

Save/Load Settings Of OS X App
Save/Load Settings Of OS X App avatar

All Apps in OS X store their settings in one or more plist files located in

To save the settings of an app use the following bash command:

Example:

To load the settings of an app use the following bash commands:

Example (works only in a terminal other than the default terminal, which is changed here):

View Controller Test: Passing Arguments When Segue Is Performed
View Controller Test: Passing Arguments When Segue Is Performed avatar

To test if an argument is passed to another view controller when performing a segue use the following function:

View Controller Test: Segue
View Controller Test: Segue avatar

To test if an ACTION of a view controller CONTROLLER triggers a certain SEGUE use the following function:

Disable System Integrity Protection (SIP)
Disable System Integrity Protection (SIP) avatar

Sometimes, when  performing a terminal command with sudo in OS X 10.11 (El Capitan) you ge a

permission denied

because of SIP. To disable this feature do the following steps: 

  1. Swith to recovery mode by rebooting and holding down CMD+R until the progress bar appears
  2. Open a Terminal by cklicking Utilities -> Terminal
  3. type csrutil disable
  4. Swith back to normal mode by rebooting