### Building a Simple Glass Screen Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Demonstrates how to construct a basic screen using glass-themed components like GlassCard and GlassButton. This serves as an example for integrating multiple glass elements into a layout. ```swift import SwiftUI struct MyGlassScreen: View { var body: some View { ScrollView { VStack(spacing: 16) { // Header card GlassCard { VStack(alignment: .leading, spacing: 8) { Text("Welcome") .font(.title2.weight(.semibold)) Text("This is a glass-themed screen") .foregroundStyle(.secondary) } } // Action button GlassButton(title: "Get Started", systemImage: "sparkles") { print("Button tapped!") } } .padding(.horizontal, 20) .padding(.vertical, 16) } .background { GlassBackground() .ignoresSafeArea() } } } ``` -------------------------------- ### Custom Theme Colors in GlassBackground.swift Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Example of how to modify the `colors` array in `GlassBackground.swift` to change the theme colors of the background. This allows for visual customization of the app's theme. ```swift colors: [ Color(red: 0.06, green: 0.07, blue: 0.10), // Dark base Color(red: 0.02, green: 0.02, blue: 0.03), // Darker edge ] ``` -------------------------------- ### Disable Animations in GlassBackground.swift Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Example of how to disable animations in `GlassBackground.swift` by setting `showsAnimatedAccent` to `false`. This can be useful for performance optimization. ```swift GlassBackground(showsAnimatedAccent: false) ``` -------------------------------- ### Adding a New Tab Case to MainTabView Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Example of how to add a new case to the `Tab` enum in `MainTabView` to include a new screen in the tab navigation. This involves defining the enum case and its corresponding title. ```swift enum Tab { case dashboard, explore, search, profile, lab, myNew var title: String { switch self { case .myNew: return "My Screen" // ... } } } ``` -------------------------------- ### Open Project in Xcode Command Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Command to open the cloned project in Xcode. This is a necessary step after cloning to begin development. ```bash open liquidglassIosSystem.xcodeproj ``` -------------------------------- ### Creating a Custom Glass Component Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Demonstrates the pattern for creating custom reusable components that adopt the glass aesthetic. It involves creating a generic struct that applies padding and a `glassSurface` modifier. ```swift struct MyGlassComponent: View { let content: Content init(@ViewBuilder content: () -> Content) { self.content = content() } var body: some View { content .padding(16) .glassSurface(cornerRadius: 24) } } ``` -------------------------------- ### Using GlassBackground Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Applies a full-screen animated background with morphing gradient blobs to a view. ```swift .background { GlassBackground() .ignoresSafeArea() } ``` -------------------------------- ### Clone Repository Command Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Standard command to clone the project repository. Ensure you replace `` with the actual URL. ```bash git clone cd liquidglassIosSystem ``` -------------------------------- ### Login Screen UI Implementation Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Implements the UI for the Login Screen using GlassCard, GlassTextField, and GlassButton components. This snippet shows the structure for email/password input and a continue button. ```swift GlassCard { VStack(alignment: .leading, spacing: 12) { Text("Sign in").font(.headline) GlassTextField(placeholder: "Email", text: $email, systemImage: "envelope.fill") GlassTextField(placeholder: "Password", text: $password, systemImage: "lock.fill", isSecure: true) GlassButton(title: "Continue", systemImage: "arrow.right") { isLoggedIn = true } } } ``` -------------------------------- ### Animated Background Control with Toggle Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Illustrates how to control the animated accent on a GlassBackground using a Toggle. This allows users to enable or disable the animation, potentially for performance or aesthetic preferences. ```swift struct CustomBackground: View { @State private var enableAnimation = true var body: some View { ZStack { GlassBackground(showsAnimatedAccent: enableAnimation) .ignoresSafeArea() Toggle("Enable Motion", isOn: $enableAnimation) .padding() } } } ``` -------------------------------- ### Themed Section with Custom GlassStyle Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Demonstrates creating a themed section using GlassContainer with custom style parameters like stroke opacity, highlight opacity, and shadow radius. This is useful for applying a consistent, customized glass effect to a group of views. ```swift struct ThemedSection: View { var body: some View { GlassContainer(style: GlassStyle( strokeOpacity: 0.30, // Brighter edges highlightOpacity: 0.20, // Stronger lens effect shadowRadius: 20 // Deeper shadow )) { VStack(spacing: 12) { GlassCard { Text("Card 1") } GlassCard { Text("Card 2") } // Both cards inherit the custom style } } } } ``` -------------------------------- ### Interactive Form with GlassTextFields and Button Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Shows how to build an interactive form using GlassTextFields for input and a GlassButton for submission. This is suitable for creating user input interfaces with a glass aesthetic. ```swift struct GlassForm: View { @State private var name = "" @State private var email = "" @State private var acceptTerms = false var body: some View { GlassCard { VStack(spacing: 14) { GlassTextField( placeholder: "Full Name", text: $name, systemImage: "person.fill" ) GlassTextField( placeholder: "Email", text: $email, systemImage: "envelope.fill" ) Toggle("Accept Terms", isOn: $acceptTerms) .tint(.cyan) GlassButton(title: "Submit", systemImage: "checkmark") { submitForm() } } } } } ``` -------------------------------- ### Accessing Glass Style Environment Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Retrieves the current Liquid Glass style from the environment. ```swift @Environment(\.liquidGlassStyle) private var style ``` -------------------------------- ### Adding a New Screen in Swift Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Code structure for adding a new screen to the application. It includes setting up a basic SwiftUI View with a ScrollView, GlassCard, GlassBackground, and navigation title. ```swift import SwiftUI struct MyNewScreen: View { var body: some View { ScrollView { VStack(spacing: 16) { GlassCard { Text("New Screen Content") } } .padding(20) } .background { GlassBackground() .ignoresSafeArea() } .navigationTitle("My Screen") } } ``` -------------------------------- ### Filter System Spaces by Query Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Filters a list of SystemSpace objects based on a search query. Returns all spaces if the query is empty. ```swift private var filteredSpaces: [SystemSpace] { let q = query.trimmingCharacters(in: .whitespacesAndNewlines) guard !q.isEmpty else { return SystemMockData.spaces } return SystemMockData.spaces.filter { $0.name.localizedCaseInsensitiveContains(q) || $0.description.localizedCaseInsensitiveContains(q) } } ``` -------------------------------- ### Frosted Glass Base Layer with .ultraThinMaterial Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Use .ultraThinMaterial to create a frosted glass base layer that adapts to light and dark modes. This is a foundational element for the liquid glass effect. ```swift RoundedRectangle(cornerRadius: 28, style: .continuous) .fill(.ultraThinMaterial) ``` -------------------------------- ### Morphing Tab Bar with Matched Geometry Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Demonstrates a morphing tab bar shape using matchedGeometryEffect for transitions between a Circle and a Capsule. ```swift // Morphing tab bar with matched geometry @Namespace private var navMorph ZStack { if isExpanded { Capsule().matchedGeometryEffect(id: "tab-surface", in: navMorph) } else { Circle().matchedGeometryEffect(id: "tab-surface", in: navMorph) } } ``` -------------------------------- ### Applying Custom Glass Style Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Applies a custom GlassStyle to a GlassContainer and its children. ```swift // Apply custom style to a section GlassContainer(style: customStyle) { // All child glass surfaces inherit this style } ``` -------------------------------- ### Data Model for System Spaces Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Defines the data model for a "SystemSpace" which includes properties like name, description, icon, and color. This struct is identifiable and used for displaying themed spaces. ```swift struct SystemSpace: Identifiable { let id = UUID() let name: String let description: String let icon: String let color: Color } ``` -------------------------------- ### Adaptive Color Scheme Environment Variables Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Access environment variables for color scheme and accessibility reduce transparency settings to ensure the UI respects user preferences and system accessibility guidelines. ```swift @Environment(\.colorScheme) private var colorScheme @Environment(\.accessibilityReduceTransparency) private var reduceTransparency ``` -------------------------------- ### GlassStyle Struct Definition Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Defines the customizable styling properties for glass surfaces, including opacity and shadow parameters. ```swift struct GlassStyle { var strokeOpacity: Double = 0.22 // Border brightness var highlightOpacity: Double = 0.16 // Lens refraction intensity var shadowOpacity: Double = 0.10 // Depth shadow var shadowRadius: CGFloat = 16 // Shadow blur var shadowY: CGFloat = 10 // Shadow offset } ``` -------------------------------- ### Adjust Glass Intensity in GlassStyle.swift Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Shows how to adjust `strokeOpacity` and `highlightOpacity` in `GlassStyle.swift` to control the intensity of glass effects like edge brightness and lens effect. ```swift var strokeOpacity: Double = 0.30 // Increase for brighter edges var highlightOpacity: Double = 0.20 // Increase for more lens effect ``` -------------------------------- ### GlassBottomSheet Presentation Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Presents a modal sheet with a glass background effect and customizable detents. Use this for displaying additional content or forms modally. ```swift .sheet(isPresented: $isPresented) { SheetContent() .presentationDetents([.medium, .large]) .presentationDragIndicator(.visible) .presentationBackground(.ultraThinMaterial) // Glass effect! } ``` -------------------------------- ### Customizing GlassCard Corner Radius Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Creates a GlassCard with a specified custom corner radius. ```swift GlassCard(cornerRadius: 30) { Text("Custom corner radius") } ``` -------------------------------- ### Glass Effect with Edge Definition and Overlay Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Achieve a glass-like appearance by combining a frosted material background with an overlay that adds subtle edge definition using a semi-transparent white border. This enhances the visual depth and clarity of UI elements. ```swift .background(.ultraThinMaterial) .overlay { RoundedRectangle(cornerRadius: cornerRadius) .strokeBorder(.white.opacity(0.18), lineWidth: 1) } ``` -------------------------------- ### GlassButton Interactive States Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Manages the pressed state for a button, providing visual feedback through scaling and haptic feedback. Use this to implement interactive buttons with a press effect. ```swift @State private var pressed = false .scaleEffect(pressed ? 0.96 : 1.0) .onLongPressGesture(minimumDuration: 0, pressing: { isPressing in pressed = isPressing }) ``` -------------------------------- ### GlassCard Anatomy and Styling Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Defines the structure and default styling for the GlassCard component, including frosted glass effect, edge highlight, and shadow. ```swift content .padding(18) // Inner spacing .background(.ultraThinMaterial) // Frosted glass .overlay { RoundedRectangle(cornerRadius: 28) .strokeBorder(.white.opacity(0.18)) // Edge highlight } .shadow(color: .black.opacity(0.25), radius: 18) // Depth ``` -------------------------------- ### GlassTextField Usage Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md A configurable text input field with optional leading icons and secure mode. Use this for email, password, or general text input fields. ```swift GlassTextField( placeholder: "Email", text: $email, systemImage: "envelope.fill", isSecure: false ) ``` -------------------------------- ### Continuous Corner Radius for Organic Curves Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Utilize the .continuous corner style for RoundedRectangle to create smoother, more organic curves, mimicking the aesthetic found in system apps like Control Center and Safari tabs. ```swift RoundedRectangle(cornerRadius: 28, style: .continuous) ``` -------------------------------- ### Custom Glass Component Styling Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Applies glass surface styling to a custom SwiftUI view, including corner radius, material, and shadow. Use this modifier to give any view a glass appearance. ```swift struct MyCustomGlassView: View { var body: some View { HStack(spacing: 12) { Image(systemName: "star.fill") .foregroundStyle(.yellow) Text("Custom Content") } .padding(16) .glassSurface( cornerRadius: 20, material: .ultraThinMaterial, allowsShadow: true, highlightOffset: .zero ) } } ``` -------------------------------- ### Apply Liquid Refraction Effect Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Adds a lens highlight for a "liquid" refraction effect using a radial gradient overlay. This effect is applied using a .overlay modifier in Swift. ```swift // Lens highlight for "liquid" refraction effect .overlay { RoundedRectangle(cornerRadius: cornerRadius, style: .continuous) .fill( RadialGradient( colors: [ Color.white.opacity(0.16), Color.clear ], center: .topLeading, startRadius: 18, endRadius: 240 ) ) .offset(x: highlightOffset.width, y: highlightOffset.height) .blendMode(.softLight) } ``` -------------------------------- ### MorphingBlob Animation Control Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Defines the parameters for an animated organic shape that mimics liquid breathing. Use this to create dynamic background elements or visual effects. ```swift MorphingBlob( phase: time, // Animation time amplitude: 0.12, // Wobble intensity points: 12 // Shape complexity ) ``` -------------------------------- ### MorphingBlob Visual Effect Source: https://github.com/sanjaynela/liquid-glass-ios-system/blob/main/README.md Applies visual styling to the MorphingBlob, including a linear gradient fill, blur, and blend mode for a liquid-like appearance. This is used to achieve the final aesthetic of the animated shape. ```swift .fill(.linearGradient(colors: [.cyan, .blue, .purple])) .blur(radius: 38) .blendMode(.plusLighter) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.