I have 3 modules:
Module 1:
struct Apple {}
Module 2:
protocol Fruit{}
extension Apple: Fruit {}
Module 3:
let any: Any = Apple()
let fruit = any as! Fruit // <- force conversion failed, any doesn't conform to Fruit
struct Basket where Content: Fruit {}
let appleBasket: Basket<Apple> = .init() // another crash by EXEC_BAD_ACCESS, but it passes compiling
if I move
extension Apple: Fruit {}
to the module 3, the crashes are all gone.
Could someone explain to me how extension works in Swift?