I am getting an error that says "Cannot convert value of type 'String' to argument type 'Test'" when trying to return a value from a function in lazy stored property. I am not able to spot any issue in the lazy var's closure.
import UIKit
public struct Value {}
public class Test {
var id: String = ""
public func getValueById(id: String) -> Value {
return Value()
}
public lazy var value: Value = {
// Compiler error: Cannot convert value of 'String' to expected argument type 'Test'
return getValueById(self.id)
}()
}