且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 SwiftUI 中访问视图的修饰符?

更新时间:2023-12-04 20:39:58

myImage的返回类型为:

_ModifiedContent<Image, _ShadowEffect>

我们可以通过以下方式访问原始图像:

We can access the original image by doing:

myImage.content

我们可以通过键入以下内容访问阴影效果修饰符:

We can access the shadow effect modifier by typing:

myImage.modifier

所以要做你想做的事,你必须输入:

So to do what you want, you have to type:

print(myImage.modifier.radius)