Category: Swift

Swift 3: Distance between two CGPoints

Swift 3: Distance between two CGPoints

Here it is in Swift 3, it’s a little different. I tried to use hypotf but it didn’t like CGFloat subtraction.

 

Protocol/delegates in Swift 3.0

Protocol/delegates in Swift 3.0

I declare this day a fine day having discovered non-Objective-C protocols! No more @objc protocol usage. Now it’s as simple as something like this:

And then in implementation

This is a really simple example, but it works and seems cleaner to me in Swift.