# Swift: Notable Beta 4 Changes

July 21, 2014

Here are some of the more notable Swift changes as of Beta 4:

### Access Control

The new access control keywords are available:

modifier
private can only be accessed from the source file where defined
internal can only be accessed from the current target where defined
public can be accessed anywhere, including any context that imports . . .

# Swift: Let's Query DNS

### Interop in the real world

July 19, 2014

So far we've been going over some of the interop capabilities in Swift, but today I want to switch gears a bit and actually put this stuff to use. Along the way we'll discover some annoyances and take opportunities not available in Objective-C to remedy them.

Let's say we want to determine if a host is reachable. To do that, we . . .

# Swift: Implicit Pointers

### The easy way

July 14, 2014

Today, let's look at Swift's implicit pointer support which can simplify our code quite a bit and works great when the callee doesn't keep the pointer alive or when it understands Objective-C and can handle retain/release/autorelease semantics. For some of the readers this will be extremely simple stuff, but I want to cover it for . . .

# Xcode Exception Breakpoints

### make the computer do the work

July 12, 2014

Improve your Xcode debugging experience with these 5 simple tips! Oh wait, I'm not selling a hocus-pocus miracle cure for cancer. [1] ahem

Many people are not aware of Xcode's powerful features for managing breakpoints during debugging. One such feature is the Exception breakpoint. Go to the Breakpoint navigator pane, click +, then . . .

# Swift: Interop in Beta 3

### Compilers are Toddlers

July 12, 2014

Compilers are toddlers. You can't reason with them, you can't plead with them. They do not understand human emotions (yet) and live only in the moment. Any obstacle or failure, no matter how minor, is a complete disaster. When they expect something you fail to deliver, they complain loudly and often in front of others, creating much . . .

# Swift: Pointers everywhere

### Unsafety? More like FUnsafety

June 27, 2014

Edit: Updated with new information to clarify that UnsafePointer<T> expects the number of instances of T, not the size in bytes.

Today let's discuss UnsafePointer<T>. Perhaps you want to use a fancy function like OSAtomicIncrement32 to keep a running counter across threads and GCD queues, without any locking, blocking, or race . . .

# Swift: withUnsafePointerToElements

### There is no escape, only vectors

June 26, 2014

Swift Array<T> is easily convertible to a C-style array, but much like the world of Garbage Collection, we have to be aware of object lifetimes.

A Swift Array is just a small stack-allocated header struct that points at heap-allocated memory to hold the elements. When you mutate an array, that header struct may change. If the array is . . .