You can achieve this effect by applying the .inner shadow modifier directly to your foreground style.
Example:
Image(systemName: "heart.fill")
.font(.system(size: 64, weight: .semibold))
.foregroundStyle(
.white
.shadow(
.inner(color: .black, radius: 3)
)
)