I have,
struct S {}
Along with,
func y (x: S) -> AnyObject {}
In Swift 2, is it possible to, within y(),
return x
My current code:
struct S {let value: Int = 0}
let x = S()
func y(x: S) -> AnyObject {return x}
Yields the following error:
return expression of type 'S' does not conform to type 'AnyObject'
Is there a way to mitigate this?
A Struct
cannot conform to AnyObject
. It can only conform to Any
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With