Skip to content

Instantly share code, notes, and snippets.

@b3ll
Created May 19, 2020 22:02
Show Gist options
  • Save b3ll/60df234ef932022dbed893c070b4c544 to your computer and use it in GitHub Desktop.
Save b3ll/60df234ef932022dbed893c070b4c544 to your computer and use it in GitHub Desktop.
import Foundation
protocol UnpackedProtocol {
associatedtype ObjectType
associatedtype PointType
var points: [PointType] { get set }
}
struct Box {}
struct Sphere {}
struct Unpacked<Box, CGFloat>: UnpackedProtocol {
typealias ObjectType = Box
typealias PointType = CGFloat
var points: [CGFloat]
}
struct Unpacked<Sphere, Double>: UnpackedProtocol {
typealias ObjectType = Sphere
typealias PointType = Double
var points: [Double]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment