You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.
public interface InterA {}
internal class ClassA: InterA {}
And expose in Swift an InterA backed by a ClassA instance,
Some cast operations fail:
private func getObject<T>(_ value: InterA) -> T? {
let castedValue = value as? T // nil
let test1 = value is T // false
let test2 = value is InterA // true
let test3 = T.self == InterA.self // true
return castedValue
}
let inter: InterA? = getObject(commonManager.api.a) // commonManager.api.a is a ClassA
It is not possible to cast value in T, even if T is InterA. If I change getObject to take value as Any, even test2 fails.
Everything works well if ClassA is public.
The use case behind that issue is to be able tu use a DI framework such as Swinject.
The text was updated successfully, but these errors were encountered:
When I declare in Kotlin :
And expose in Swift an
InterA
backed by aClassA
instance,Some cast operations fail:
It is not possible to cast
value
inT
, even ifT
isInterA
. If I change getObject to takevalue
asAny
, eventest2
fails.Everything works well if ClassA is public.
The use case behind that issue is to be able tu use a DI framework such as Swinject.
The text was updated successfully, but these errors were encountered: