فهرست منبع

Add code samples to documentation

Lucas Brown 5 سال پیش
والد
کامیت
56dfc931b8

+ 15 - 1
Sources/SwiftUIVisualEffects/View Extensions/View+blurEffectStyle.swift

@@ -6,7 +6,21 @@
 import SwiftUI
 import SwiftUI
 
 
 public extension View {
 public extension View {
-	/// Sets the style for blur effects within this view.
+	/**
+	Sets the style for blur effects within this view.
+	
+	To set a specific style for all blur effects and vibrancy effects containing blur effects within a view, use the blurEffectStyle(_:) modifier:
+	```
+	ZStack {
+		backgroundContent
+			.blurEffect()
+		
+		foregroundContent
+			.vibrancyEffect()
+	}
+	.blurEffectStyle(.systemMaterial)
+	```
+	*/
 	func blurEffectStyle(_ style: UIBlurEffect.Style) -> some View {
 	func blurEffectStyle(_ style: UIBlurEffect.Style) -> some View {
 		environment(\.blurEffectStyle, style)
 		environment(\.blurEffectStyle, style)
 	}
 	}

+ 20 - 1
Sources/SwiftUIVisualEffects/View Extensions/View+vibrancyEffectStyle.swift

@@ -6,7 +6,26 @@
 import SwiftUI
 import SwiftUI
 
 
 public extension View {
 public extension View {
-	/// Sets the style for vibrancy effects within this view.
+	/**
+	Sets the style for vibrancy effects within this view.
+	
+	To set a specific style for all vibrancy effects within a view, use the vibrancyEffectStyle(_:) modifier:
+	```
+	ZStack {
+		backgroundContent
+			.blurEffect()
+		
+		VStack {
+			topContent
+				.vibrancyEffect()
+			
+			bottomContent
+				.vibrancyEffect()
+		}
+		.vibrancyEffectStyle(.fill)
+	}
+	```
+	*/
 	func vibrancyEffectStyle(_ style: UIVibrancyEffectStyle) -> some View {
 	func vibrancyEffectStyle(_ style: UIVibrancyEffectStyle) -> some View {
 		environment(\.vibrancyEffectStyle, style)
 		environment(\.vibrancyEffectStyle, style)
 	}
 	}