I'm interested to know if overriding a lazy stored property in a sub-class
is recommended or not. For example:
class CustomSegue: NSStoryboardSegue {
lazy var animator: CustomAnimator()
override func prepare() {
....
}
}
class CustomSlideRightSegue: CustomSegue {
override lazy var animator: CustomAnimator(.slideRight)
}
This works fine and the compiler does not complain. However:
1. Why is overriding lazy stored properties supported, while overriding a
non-lazy stored property is not.
2. Is this behaviour intended and/or recommended.
3. I realise you can achieve the same result by overriding init in the
sub-class and assigning to a non-lazy property, however often this reduces
clarity and introduces un-necessary boiler-plate code (especially if init
takes a number of args).
Thanks!
John
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users