What is the difference between using a ZStack
versus using the .overlay()
modifier.
Apple says:
ZStack
= "A view that overlays its children, aligning them in both axes."
.overlay
= "Layers a secondary view in front of this view."
Some examples:
ZStack(alignment: .bottom) {
Image(systemName: "folder")
.font(.system(size: 55, weight: .thin))
Text("❤️")
}
Image(systemName: "folder")
.font(.system(size: 55, weight: .thin))
.overlay(Text("❤️"), alignment: .bottom)
Not considering code size, is there a distinct purpose where one must be used over the other?