This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CGPoint : Hashable { | |
func distance(point: CGPoint) -> Float { | |
let dx = Float(x - point.x) | |
let dy = Float(y - point.y) | |
return sqrt((dx * dx) + (dy * dy)) | |
} | |
public var hashValue: Int { | |
// iOS Swift Game Development Cookbook | |
// https://books.google.se/books?id=QQY_CQAAQBAJ&pg=PA304&lpg=PA304&dq=swift+CGpoint+hashvalue&source=bl&ots=1hp2Fph274&sig=LvT36RXAmNcr8Ethwrmpt1ynMjY&hl=sv&sa=X&ved=0CCoQ6AEwAWoVChMIu9mc4IrnxgIVxXxyCh3CSwSU#v=onepage&q=swift%20CGpoint%20hashvalue&f=false | |
return x.hashValue << 32 ^ y.hashValue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Marlon Monroy on 5/19/18. | |
// Copyright © 2018 Monroy.io All rights reserved. | |
// | |
import Foundation | |
import UIKit | |
protocol Shimmerable { | |
func start(count: Int) -> Void |