View+vibrancyEffectStyle.swift 555 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * SwiftUIVisualEffects
  3. */
  4. import SwiftUI
  5. public extension View {
  6. /**
  7. Sets the style for vibrancy effects within this view.
  8. To set a specific style for all vibrancy effects within a view, use the `vibrancyEffectStyle(_:)` modifier:
  9. ```
  10. ZStack {
  11. backgroundContent
  12. .blurEffect()
  13. VStack {
  14. topContent
  15. .vibrancyEffect()
  16. bottomContent
  17. .vibrancyEffect()
  18. }
  19. .vibrancyEffectStyle(.fill)
  20. }
  21. ```
  22. */
  23. func vibrancyEffectStyle(_ style: UIVibrancyEffectStyle) -> some View {
  24. environment(\.vibrancyEffectStyle, style)
  25. }
  26. }