Category: Swift

  • Improved Wiggling iOS 9 UICollectionView (Swift)

    With iOS 9 UICollectionView now has built-in drag and drop reorder. This is very easy to enable specially when using a UICollectionViewController. However there is no animation showing that the move operation started or finished, and worse there is no delegate call or notification to be informed of move start/end. So here is my UICollectionView subclass which […]

  • Swift: should a function Throw or return an Optional?

    Since Swift 2.0 we now have two ways for a function to fail: It can return an Optional Or it can Throw Let’s use a very simple example: a function to return the square root of a number. It is supposed to fail if the number was negative of course. Return an Optional func sqrt1(number: Float) -> Float? […]