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
Write code with composed interface. Can be something like
typeCarinterface {
WheelCount() int
}
typeLimousineinterface {
CarSeats() intSetSeats(seatsint)
}
Full go code is available at Go Code
2. Generate go mobile bindings for iOS and android, e.g. gomobile bind -target=ios data
3. Create platform specific app and call a go method which tries to do type conversion. Type conversion may be:
iOS, fails to do type conversion. The limousine is stripped down to fulfill the car interface only and does not fulfill the limousine interface anymore:
So in my understanding type conversion should work on iOS as it does on android and in normal go itself. But using gomobile on iOS, interfaces seem to loose other fulfilled interfaces once they're passed to a method which receives a specific interface only.
Or am I doing something wrong? Otherwise I would like to help solving this issue. Sadly I am new to the go mobile tooling itself. Maybe somebody can point me into the right direction?
Is this intentionally not working or is it expected to work?
Thanks for your help!
The text was updated successfully, but these errors were encountered:
jotdl
changed the title
x/mobile/cmd/gomobile: type conversion differs on android and iOS
x/mobile/cmd/gomobile: type conversion not working on iOS
Oct 8, 2016
Hey,
I have a (hopefully small) issue with type conversion related to usage of gomobile:
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
Full go code is available at Go Code
2. Generate go mobile bindings for iOS and android, e.g.
gomobile bind -target=ios data
3. Create platform specific app and call a go method which tries to do type conversion. Type conversion may be:
and platform specific code like this for iOS
What did you expect to see?
Type conversion from Car to Limousine should be possible if the object fulfills Limousine.
Output of type conversion on Go, iOS and Android:
What did you see instead?
Type conversion is not possible on iOS between interfaces. Output of type conversion Go, Android (as expected):
iOS, fails to do type conversion. The limousine is stripped down to fulfill the car interface only and does not fulfill the limousine interface anymore:
So in my understanding type conversion should work on iOS as it does on android and in normal go itself. But using gomobile on iOS, interfaces seem to loose other fulfilled interfaces once they're passed to a method which receives a specific interface only.
Or am I doing something wrong? Otherwise I would like to help solving this issue. Sadly I am new to the go mobile tooling itself. Maybe somebody can point me into the right direction?
Is this intentionally not working or is it expected to work?
Thanks for your help!
The text was updated successfully, but these errors were encountered: