Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Agarunov/cb1384cb2793138c4d1783faebc15c15 to your computer and use it in GitHub Desktop.
Save Agarunov/cb1384cb2793138c4d1783faebc15c15 to your computer and use it in GitHub Desktop.
// Declared inside framework
struct Point: Hashable {
let x: Float
let y: Float
init(x: Float, y: Float) {
self.x = x
self.y = y
}
}
// In the main app
extension Point {
init(x: Int, y: Int) {
// prohibited!
// self.x = Float(x)
// self.y = Float(y)
self.init(x: Float(x), y: Float(y))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment