We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
To demonstrate my generic use, I write 2 pieces of code as below.
import Foundation import Bond protocol MyProtocolType { } struct MyValueType: MyProtocolType { } class MyCustomClass { static let singleton = MyCustomClass() private init() { } func getList() -> ObservableArray<MyProtocolType> { let list = MutableObservableArray([MyValueType()]) return list.readOnlyView } }
import Foundation import Bond protocol MyProtocolType { } struct MyValueType: MyProtocolType { } class MyCustomClass { static let singleton = MyCustomClass() private init() { } func getList() -> ObservableArray<MyValueType> { let list = MutableObservableArray([MyValueType()]) return list.readOnlyView } }
The difference is at the function's return type: ObservableArray<MyProtocolType> vs ObservableArray<MyValueType>.
ObservableArray<MyProtocolType>
ObservableArray<MyValueType>
I think the correct syntax for generic usage is the 1st one, but Xcode reports error with it. So I need to change to the 2nd one.
I don't understand it. Or is my syntax incorrect? If you know the reason, please point me out.
Thank you!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
To demonstrate my generic use, I write 2 pieces of code as below.
The difference is at the function's return type:
ObservableArray<MyProtocolType>
vsObservableArray<MyValueType>
.I think the correct syntax for generic usage is the 1st one, but Xcode reports error with it. So I need to change to the 2nd one.
I don't understand it. Or is my syntax incorrect? If you know the reason, please point me out.
Thank you!
The text was updated successfully, but these errors were encountered: