Description
Call scaledToFill after frame without width lead to crash. However, if use SwiftUI Image View like this, no crash but no effect either. Not sure if it is a bug, if not please ignore.
List(0 ..< 1) { _ in
AnimatedImage(url: url)
.frame(height: 100)
.frame(minWidth: 0, maxWidth: .infinity)
.scaledToFill()
}
2019-09-30 23:11:24.806087+0800 Demo[6396:1865239] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]. Layer: <CALayer:0x28123daa0; position = CGPoint (0 0); bounds = CGRect (0 0; 0 0); delegate = <TtGC7SwiftUI16PlatformViewHostGVS_P10$1f071c1b432PlatformViewRepresentableAdaptorV17SDWebImageSwiftUI13AnimatedImage_: 0x105724350; frame = (0 0; 0 0); anchorPoint = (0, 0); tintColor = UIExtendedSRGBColorSpace 0.0392157 0.517647 1 1; layer = <CALayer: 0x28123daa0>>; sublayers = (<CALayer: 0x28123da00>); opaque = YES; allowsGroupOpacity = YES; anchorPoint = CGPoint (0 0)>'
*** First throw call stack:
(0x1b9f95c30 0x1b9cb00c8 0x1b9e853ac 0x1c0a7ae9c 0x1c0a7adcc 0x1c0a7a8a0 0x1be4b563c 0x1f05b5ff0 0x1f05b44a4 0x1f05b3dcc 0x1f05b3134 0x1f0151268 0x1f0349680 0x1f03493ac 0x1f0348ff8 0x1f0348e68 0x1f009f078 0x1f05193e4 0x1f050f728 0x1f06a39cc 0x1f06a39fc 0x1be4d2abc 0x1b9cabaf0 0x1c0a70384 0x1c0a7068c 0x1be4be41c 0x1be4c4f60 0x1be216a84 0x1be1e3704 0x1be200e10 0x1f02710cc 0x1f0271294 0x1be4d2abc 0x1b9cabaf0 0x1c0a70384 0x1c0a7068c 0x1c0a83bf4 0x1c09c93e4 0x1c09f43a0 0x1be042788 0x1b9f1107c 0x1b9f10800 0x1b9f0b800 0x1b9f0b098 0x1c406d534 0x1be02a7ac 0x104fe6cd4 0x1b9d8af30)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)