Do you need help on a specific subject? Use the contact form (Request a blog entry) on the right hand side.

Swift Gotcha's

As nice a language as Swift is, there are still some gotcha's that can catch even an experienced programmer by surprise. This page contains links to posts that exemplify such gotcha's.

Using the same pointer in two arguments

How process(inbuf: &inoutbuf, outbuf: &inoutbufcan have some nasty side effects.

UnsafePointer and UnsafeMutablePointer

The difference between UnsafePointer and UnsafeMutablePointer. Or when using the same syntax can lead to very different results.

Unexpected behaviour for observers on inout arguments

Turns out, inout arguments and observers don't mix well.

Surprising behaviour for empty array slices

Not all empty array slices are created equally, [1 ... 0] is not the same as [1 ..< 1]

String.Index and the time of creation

The time of creation of a String.Index instance determines its usable range...

Careful with auto-suggestions from the compiler

How a linked list using 'while let' can get you into trouble.

Value of optional type Bool not unwrapped

The fix-it solution for weak unwrapped bools can create runtime crashes

The defer statement

Be careful with the scope a defer statement is in.

Optionals and weak references are not the same

Prevent non-reproducible runtime crashes: never 'force-unwrap' a weak reference.

No comments:

Post a Comment