Skip to content

Instantly share code, notes, and snippets.

View blakeprobinson's full-sized avatar

Blake Robinson blakeprobinson

  • Philadelphia, PA
View GitHub Profile
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
@saito-sv
saito-sv / Shimmer.swift
Last active June 24, 2024 18:22
a simple shimmer view in swift
// 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