I am a little odd about it too. However, if you give it a try, you will get the results.
var lazyStruct = lazyTest(lazyVariable: 5, someProperty: 6) lazyStruct.lazyVariable // 5 var anotherStruct = lazyTest(lazyVariable:nil, someProperty: 7) anotherStruct.lazyVariable // 10 Everything works fine. If you give it a value, it just ignores the lazy part. If you give it a nil, it works as you expect. So initializer of Struct just adopts to a more flexible way, I think. Zhaoxin On Fri, May 27, 2016 at 5:15 PM, Pritesh Nandgaonkar via swift-users < [email protected]> wrote: > I have a struct with two properties one being Lazy and other being the > normal one.When I try to initialise the struct the init function > autosuggests the lazy property to be optional.Ideally the implementation > should be such that, only non lazy and non computed properties must have > been passed to the initialiser.Obviously this could be done through custom > init implementation.But would like to know why its not handled. > > Have a look at the image for reference. > > [image: Inline image 2] > -- > Pritesh Nandgaonkar > Department of Electrical Engineering > IIT Bomba > > _______________________________________________ > swift-users mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-users > >
_______________________________________________ swift-users mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-users
