### Swift Package Manager Installation Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Provides the dependency declaration for integrating ActivityIndicatorView into a Swift project using the Swift Package Manager. Ensure your project supports the specified platform requirements. ```swift dependencies: [ .package(url: "https://github.com/exyte/ActivityIndicatorView.git") ] ``` -------------------------------- ### SwiftUI Flickering Dots Indicator Examples Source: https://context7.com/exyte/activityindicatorview/llms.txt Presents examples of the .flickeringDots() type, which creates a pulsing effect with dots arranged in a circle. Customization options include the count of dots to influence the smoothness of the wave effect. ```swift import SwiftUI import ActivityIndicatorView struct FlickeringDotsExample: View { @State private var isActive = true var body: some View { VStack(spacing: 30) { // Standard flickering pattern with 8 dots ActivityIndicatorView(isVisible: $isActive, type: .flickeringDots()) .frame(width: 60, height: 60) .foregroundColor(.cyan) // More dots for smoother wave effect ActivityIndicatorView(isVisible: $isActive, type: .flickeringDots(count: 12)) .frame(width: 70, height: 70) .foregroundColor(.teal) // Minimal dots for simple pulse ActivityIndicatorView(isVisible: $isActive, type: .flickeringDots(count: 6)) .frame(width: 50, height: 50) .foregroundColor(.mint) } } } // Each dot pulses with opacity and scale changes // Linear animation with staggered delays creates wave effect ``` -------------------------------- ### SwiftUI Scaling Dots Indicator Examples Source: https://context7.com/exyte/activityindicatorview/llms.txt Demonstrates the .scalingDots() type for creating a horizontal row of dots that scale sequentially. This example shows how to adjust the number of dots and the spacing (inset) between them for compact or spaced-out indicators. ```swift import SwiftUI import ActivityIndicatorView struct ScalingDotsExample: View { @State private var showLoader = true var body: some View { VStack(spacing: 30) { // Default: 3 dots with 2pt spacing ActivityIndicatorView(isVisible: $showLoader, type: .scalingDots()) .frame(width: 60, height: 50) .foregroundColor(.red) // More dots with custom spacing ActivityIndicatorView(isVisible: $showLoader, type: .scalingDots(count: 5, inset: 4)) .frame(width: 100, height: 50) .foregroundColor(.orange) // Tight spacing for compact indicator ActivityIndicatorView(isVisible: $showLoader, type: .scalingDots(count: 4, inset: 1)) .frame(width: 70, height: 40) .foregroundColor(.yellow) } .padding() } } // Dots scale up and down in sequence from left to right // EaseOut animation creates bouncing effect // inset parameter controls spacing between dots ``` -------------------------------- ### SwiftUI Rotating Dots Indicator Examples Source: https://context7.com/exyte/activityindicatorview/llms.txt Illustrates the use of the .rotatingDots() type for creating animations where dots rotate around a central point. Examples show how to adjust the number of dots to achieve denser or more minimal patterns. ```swift import SwiftUI import ActivityIndicatorView struct RotatingDotsExample: View { @State private var isLoading = true var body: some View { HStack(spacing: 50) { // Default: 5 dots rotating with scale effect ActivityIndicatorView(isVisible: $isLoading, type: .rotatingDots()) .frame(width: 50, height: 50) .foregroundColor(.blue) // More dots for denser pattern ActivityIndicatorView(isVisible: $isLoading, type: .rotatingDots(count: 8)) .frame(width: 60, height: 60) .foregroundColor(.pink) // Fewer dots for minimal look ActivityIndicatorView(isVisible: $isLoading, type: .rotatingDots(count: 3)) .frame(width: 40, height: 40) .foregroundColor(.indigo) } } } // Dots rotate clockwise while also scaling in/out // Uses timing curve animation for smooth acceleration ``` -------------------------------- ### SwiftUI Gradient Activity Indicator Examples Source: https://context7.com/exyte/activityindicatorview/llms.txt Demonstrates the usage of ActivityIndicatorView with various gradient configurations in SwiftUI. Supports multiple colors, custom line caps (.round, .square), and adjustable line widths. The rotation is animated over 1.5 seconds. ```swift import SwiftUI import ActivityIndicatorView struct GradientIndicatorExample: View { @State private var isLoading = true var body: some View { VStack(spacing: 40) { // Two-color gradient (classic) ActivityIndicatorView( isVisible: $isLoading, type: .gradient([.white, .red]) ) .frame(width: 60, height: 60) // Multi-color rainbow gradient ActivityIndicatorView( isVisible: $isLoading, type: .gradient([.red, .orange, .yellow, .green, .blue, .purple]) ) .frame(width: 80, height: 80) // Custom line width and cap style ActivityIndicatorView( isVisible: $isLoading, type: .gradient([.cyan, .pink], .round, lineWidth: 6) ) .frame(width: 70, height: 70) // Thin line with square caps ActivityIndicatorView( isVisible: $isLoading, type: .gradient([.blue, .purple], .square, lineWidth: 2) ) .frame(width: 60, height: 60) // On dark background ActivityIndicatorView( isVisible: $isLoading, type: .gradient([.yellow, .orange, .red], .round, lineWidth: 5) ) .frame(width: 90, height: 90) .background(Color.black) .cornerRadius(10) } .padding() } } // Uses AngularGradient with trimmed circle // Linear rotation over 1.5 seconds // Supports multiple colors for complex gradients // lineCap options: .butt (default), .round, .square ``` -------------------------------- ### SwiftUI Arcs Indicator Examples Source: https://context7.com/exyte/activityindicatorview/llms.txt Demonstrates how to use the .arcs() type from ActivityIndicatorView to create rotating concentric arc animations. This includes variations for the number of arcs and their line width, allowing for complex or delicate visual effects. ```swift import SwiftUI import ActivityIndicatorView struct ArcsIndicatorExample: View { @State private var isVisible = true var body: some View { VStack(spacing: 40) { // Default: 3 arcs with 2pt line width ActivityIndicatorView(isVisible: $isVisible, type: .arcs()) .frame(width: 60, height: 60) .foregroundColor(.purple) // More arcs for complex animation ActivityIndicatorView(isVisible: $isVisible, type: .arcs(count: 5, lineWidth: 3)) .frame(width: 80, height: 80) .foregroundColor(.orange) // Thin, delicate arcs ActivityIndicatorView(isVisible: $isVisible, type: .arcs(count: 4, lineWidth: 1)) .frame(width: 70, height: 70) .foregroundColor(.green) } .padding() } } // Each arc rotates at a random speed between 0.2x and 0.5x // Creates an elegant, organic movement pattern ``` -------------------------------- ### Platform Requirements Source: https://context7.com/exyte/activityindicatorview/llms.txt Specifies the minimum platform versions required for the ActivityIndicatorView library. Ensure your project's deployment targets meet these requirements for compatibility. ```swift // Supported platforms .platforms([ .macOS(.v10_15), // macOS 10.15+ .iOS(.v13), // iOS 13+ .watchOS(.v6), // watchOS 6+ .tvOS(.v13) // tvOS 13+ ]) ``` -------------------------------- ### Basic Activity Indicator View Usage in SwiftUI Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Demonstrates the fundamental creation of an ActivityIndicatorView in SwiftUI. It takes a binding to a boolean for visibility and an indicator type as parameters. Dependencies include SwiftUI. ```swift ActivityIndicatorView(isVisible: $showLoadingIndicator, type: .default) ``` -------------------------------- ### Swift Package Manager Integration Source: https://context7.com/exyte/activityindicatorview/llms.txt Integrates the ActivityIndicatorView library into your project using Swift Package Manager. This involves adding the library's Git URL to your Package.swift file and declaring it as a dependency for your target. ```swift // Package.swift import PackageDescription let package = Package( name: "MyApp", dependencies: [ .package(url: "https://github.com/exyte/ActivityIndicatorView.git", from: "1.0.0") ], targets: [ .target( name: "MyApp", dependencies: ["ActivityIndicatorView"] // Explicitly list the dependency ) ] ) ``` -------------------------------- ### SwiftUI Custom Activity Indicator Combinations with ActivityIndicatorView Source: https://context7.com/exyte/activityindicatorview/llms.txt This SwiftUI code demonstrates creating custom loading views using ActivityIndicatorView with various indicator types and messages. It includes a reusable CustomLoadingView and a MultiStepLoadingView that cycles through different indicators and messages over time. Dependencies include SwiftUI and ActivityIndicatorView. ```swift import SwiftUI import ActivityIndicatorView struct CustomLoadingView: View { @State private var isLoading = true let indicatorType: ActivityIndicatorView.IndicatorType let message: String var body: some View { VStack(spacing: 20) { ActivityIndicatorView(isVisible: $isLoading, type: indicatorType) .frame(width: 60, height: 60) .foregroundColor(.blue) Text(message) .font(.caption) .foregroundColor(.secondary) } .padding(30) .background(Color(.systemBackground)) .cornerRadius(15) .shadow(radius: 10) } } struct MultiStepLoadingView: View { @State private var currentStep = 0 @State private var isLoading = true let steps = [ ("Connecting...", ActivityIndicatorView.IndicatorType.rotatingDots()), ("Loading data...", ActivityIndicatorView.IndicatorType.gradient([.blue, .purple])), ("Processing...", ActivityIndicatorView.IndicatorType.equalizer()), ("Almost done...", ActivityIndicatorView.IndicatorType.growingArc(.green)) ] var body: some View { ZStack { Color.black.opacity(0.5) .ignoresSafeArea() if currentStep < steps.count { CustomLoadingView( isLoading: $isLoading, indicatorType: steps[currentStep].1, message: steps[currentStep].0 ) } } .onAppear { startLoadingSequence() } } func startLoadingSequence() { Timer.scheduledTimer(withTimeInterval: 2.0, repeats: true) { timer in if currentStep < steps.count - 1 { currentStep += 1 } else { timer.invalidate() isLoading = false } } } } ``` -------------------------------- ### Using Specific Indicator Types with Parameters Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Illustrates how to use specific indicator types with custom parameters, such as `growingArc` with a custom color and line width. This provides fine-grained control over the animation's visual style. ```swift ActivityIndicatorView(isVisible: $showLoadingIndicator, type: .growingArc(.red, lineWidth: 4)) .frame(width: 50.0, height: 50.0) ``` -------------------------------- ### Customizable Default iOS-Style Spinner Source: https://context7.com/exyte/activityindicatorview/llms.txt Illustrates the customization options for the default `.default()` indicator. This includes adjusting the element count for smoother animations and applying standard SwiftUI modifiers for size and appearance. ```swift import SwiftUI import ActivityIndicatorView struct DefaultIndicatorExample: View { @State private var showIndicator = true var body: some View { VStack(spacing: 30) { // Standard iOS-style spinner with 8 elements ActivityIndicatorView(isVisible: $showIndicator, type: .default()) // Default count .frame(width: 50, height: 50) .foregroundColor(.gray) // Custom element count (more elements = smoother animation) ActivityIndicatorView(isVisible: $showIndicator, type: .default(count: 12)) // 12 elements .frame(width: 50, height: 50) .foregroundColor(.red) // Large indicator with custom styling ActivityIndicatorView(isVisible: $showIndicator, type: .default(count: 10)) // 10 elements .frame(width: 80, height: 80) .foregroundColor(.blue) .background(Color.gray.opacity(0.2)) .cornerRadius(10) } } } // Implementation detail: Each element is a rounded rectangle // positioned in a circle, with opacity animation staggered by delay ``` -------------------------------- ### Basic SwiftUI Indicator Usage Source: https://context7.com/exyte/activityindicatorview/llms.txt Demonstrates the fundamental usage of ActivityIndicatorView in a SwiftUI view. It shows how to toggle the indicator's visibility using a @State variable and apply basic modifiers like frame and foreground color. ```swift import SwiftUI import ActivityIndicatorView struct LoadingView: View { @State private var isLoading: Bool = true var body: some View { VStack { ActivityIndicatorView(isVisible: $isLoading, type: .default()) // Basic indicator .frame(width: 50, height: 50) .foregroundColor(.blue) Button("Toggle Loading") { isLoading.toggle() } } } } ``` -------------------------------- ### SwiftUI Network Loading View with ActivityIndicatorView Source: https://context7.com/exyte/activityindicatorview/llms.txt This SwiftUI view demonstrates how to integrate ActivityIndicatorView with network requests, including loading states and error handling. It utilizes @StateObject for managing the ViewModel and displays different UI states based on network activity. Dependencies include SwiftUI and ActivityIndicatorView. ```swift import SwiftUI import ActivityIndicatorView struct NetworkLoadingView: View { @StateObject private var viewModel = NetworkViewModel() var body: some View { ZStack { // Main content ScrollView { ForEach(viewModel.items, id: \.id) { item in ItemRow(item: item) } } // Loading overlay if viewModel.isLoading { Color.black.opacity(0.4) .ignoresSafeArea() VStack(spacing: 20) { ActivityIndicatorView( isVisible: $viewModel.isLoading, type: .gradient([.blue, .purple]) ) .frame(width: 80, height: 80) Text("Loading...") .foregroundColor(.white) .font(.headline) } .padding(30) .background(Color.white.opacity(0.1)) .cornerRadius(15) } // Error state if let error = viewModel.error { VStack(spacing: 15) { Image(systemName: "exclamationmark.triangle") .font(.largeTitle) .foregroundColor(.red) Text(error) .multilineTextAlignment(.center) Button("Retry") { Task { await viewModel.loadData() } } .buttonStyle(.borderedProminent) } .padding() } } .task { await viewModel.loadData() } } } @MainActor class NetworkViewModel: ObservableObject { @Published var items: [Item] = [] @Published var isLoading = false @Published var error: String? func loadData() async { isLoading = true error = nil do { // Simulate network request try await Task.sleep(nanoseconds: 2_000_000_000) items = try await fetchItems() isLoading = false } catch { self.error = error.localizedDescription isLoading = false } } private func fetchItems() async throws -> [Item] { // Your network logic here return [] } } struct Item: Identifiable { let id: UUID let title: String } struct ItemRow: View { let item: Item var body: some View { Text(item.title) .padding() } } ``` -------------------------------- ### Growing Circle Indicator with SwiftUI Source: https://context7.com/exyte/activityindicatorview/llms.txt Presents a simple, unobtrusive loading indicator where a circle expands while simultaneously fading out. This indicator has no configurable parameters, offering a straightforward animation. ```swift import SwiftUI import ActivityIndicatorView struct GrowingCircleExample: View { @State private var isVisible = true var body: some View { ZStack { Color.gray.opacity(0.1) VStack(spacing: 50) { // Simple, minimal circle ActivityIndicatorView(isVisible: $isVisible, type: .growingCircle) .frame(width: 50, height: 50) .foregroundColor(.blue) // Larger circle for prominent loading ActivityIndicatorView(isVisible: $isVisible, type: .growingCircle) .frame(width: 80, height: 80) .foregroundColor(.purple) // Small subtle indicator ActivityIndicatorView(isVisible: $isVisible, type: .growingCircle) .frame(width: 30, height: 30) .foregroundColor(.green) } } .ignoresSafeArea() } } ``` -------------------------------- ### Indicator in Async Context with Data Loading Source: https://context7.com/exyte/activityindicatorview/llms.txt Shows how to use ActivityIndicatorView within an asynchronous task to indicate data loading. The indicator overlays content and is managed by the `isLoading` state, which is updated before and after an async operation. ```swift import SwiftUI import ActivityIndicatorView struct DataLoadingView: View { @State private var isLoading = false @State private var data: [String] = [] var body: some View { ZStack { List(data, id: \.self) { item in Text(item) } // Overlay loading indicator if isLoading { ActivityIndicatorView(isVisible: $isLoading, type: .gradient([.blue, .purple])) // Gradient indicator .frame(width: 100, height: 100) .background(Color.black.opacity(0.3)) .cornerRadius(10) } } .task { // Trigger data loading when the view appears await loadData() } } func loadData() async { isLoading = true try? await Task.sleep(nanoseconds: 2_000_000_000) // Simulate network delay data = ["Item 1", "Item 2", "Item 3"] isLoading = false } } ``` -------------------------------- ### ActivityIndicatorView Indicator Type: Equalizer Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Configures the equalizer indicator type. It accepts a `count` parameter to specify the number of bars in the equalizer. ```swift .equalizer(count: 5) ``` -------------------------------- ### Opacity Dots Indicator with SwiftUI Source: https://context7.com/exyte/activityindicatorview/llms.txt Displays a horizontal series of dots with an opacity animation to indicate loading. Customization includes the number of dots and spacing. This effect creates a subtle wave motion. ```swift import SwiftUI import ActivityIndicatorView struct OpacityDotsExample: View { @State private var isAnimating = true var body: some View { HStack(spacing: 60) { // Standard opacity wave ActivityIndicatorView(isVisible: $isAnimating, type: .opacityDots()) .frame(width: 80, height: 50) .foregroundColor(.purple) // More dots with wider spacing ActivityIndicatorView(isVisible: $isAnimating, type: .opacityDots(count: 5, inset: 6)) .frame(width: 120, height: 50) .foregroundColor(.indigo) // Compact version ActivityIndicatorView(isVisible: $isAnimating, type: .opacityDots(count: 3, inset: 2)) .frame(width: 60, height: 40) .foregroundColor(.blue) } } } ``` -------------------------------- ### ActivityIndicatorView Indicator Type: Opacity Dots Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Configures the opacity dots indicator type. It accepts `count` for the number of dots and `inset` to control the spacing between them. ```swift .opacityDots(count: 3, inset: 4) ``` -------------------------------- ### Equalizer Indicator with SwiftUI Source: https://context7.com/exyte/activityindicatorview/llms.txt Implements a vertical bar indicator resembling an audio equalizer for loading states. The number of bars can be adjusted to create different visual densities. Bars animate by scaling vertically. ```swift import SwiftUI import ActivityIndicatorView struct EqualizerExample: View { @State private var isPlaying = true var body: some View { HStack(spacing: 40) { // Classic 5-bar equalizer ActivityIndicatorView(isVisible: $isPlaying, type: .equalizer()) .frame(width: 60, height: 50) .foregroundColor(.green) // Wide equalizer with many bars ActivityIndicatorView(isVisible: $isPlaying, type: .equalizer(count: 8)) .frame(width: 100, height: 60) .foregroundColor(.cyan) // Minimal 3-bar version ActivityIndicatorView(isVisible: $isPlaying, type: .equalizer(count: 3)) .frame(width: 40, height: 40) .foregroundColor(.mint) } .padding() } } ``` -------------------------------- ### ActivityIndicatorView Indicator Type: Growing Circle Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Configures the growing circle indicator type. This type has no additional parameters and displays a simple growing circle animation. ```swift .growingCircle() ``` -------------------------------- ### Growing Arc Indicator with SwiftUI Source: https://context7.com/exyte/activityindicatorview/llms.txt Features an arc that dynamically grows and shrinks to indicate progress or loading. Allows customization of color and line width, with a unique explicit color parameter. It uses a custom Shape protocol with animatableData. ```swift import SwiftUI import ActivityIndicatorView struct GrowingArcExample: View { @State private var isLoading = true var body: some View { VStack(spacing: 40) { // Default black arc with 4pt line ActivityIndicatorView(isVisible: $isLoading, type: .growingArc()) .frame(width: 60, height: 60) // Custom color and line width ActivityIndicatorView(isVisible: $isLoading, type: .growingArc(.red, lineWidth: 6)) .frame(width: 80, height: 80) // Thin, delicate arc ActivityIndicatorView(isVisible: $isLoading, type: .growingArc(.blue, lineWidth: 2)) .frame(width: 70, height: 70) // With background for contrast ActivityIndicatorView(isVisible: $isLoading, type: .growingArc(.white, lineWidth: 5)) .frame(width: 90, height: 90) .background(Color.black.opacity(0.8)) .cornerRadius(10) } } } ``` -------------------------------- ### ActivityIndicatorView Indicator Type: Scaling Dots Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Configures the scaling dots indicator type. It accepts `count` for the number of dots and `inset` to control the spacing between them. ```swift .scalingDots(count: 3, inset: 2) ``` -------------------------------- ### Customizing Activity Indicator View Appearance Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Shows how to customize the appearance of an ActivityIndicatorView using standard SwiftUI modifiers like frame and foregroundColor. This allows for visual integration into the app's design. ```swift ActivityIndicatorView(isVisible: $showLoadingIndicator, type: .default) .frame(width: 50.0, height: 50.0) .foregroundColor(.red) ``` -------------------------------- ### ActivityIndicatorView Indicator Type: Flickering Dots Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Configures the flickering dots indicator type. It accepts a `count` parameter to determine the number of dots that will flicker. ```swift .flickeringDots(count: 8) ``` -------------------------------- ### ActivityIndicatorView Indicator Type: Default Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Configures the default indicator type, similar to iOS UIActivityIndicator. It accepts a `count` parameter to adjust the number of elements in the indicator. ```swift .default(count: 8) ``` -------------------------------- ### ActivityIndicatorView Indicator Type: Gradient Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Configures the gradient indicator type, which features a circle with an angular gradient border stroke. It accepts an array of colors and a line width. ```swift .gradient([.white, .red], lineWidth: 4) ``` -------------------------------- ### ActivityIndicatorView Indicator Type: Arcs Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Configures the arcs indicator type. It accepts `count` for the number of arcs and `lineWidth` to control the thickness of the arc lines. ```swift .arcs(count: 3, lineWidth: 2) ``` -------------------------------- ### ActivityIndicatorView Indicator Type: Rotating Dots Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Configures the rotating dots indicator type. It accepts a `count` parameter to specify the number of dots that rotate. ```swift .rotatingDots(count: 5) ``` -------------------------------- ### ActivityIndicatorView Indicator Type: Growing Arc Source: https://github.com/exyte/activityindicatorview/blob/master/README.md Configures the growing arc indicator type with a custom color and line width. The default color is black. ```swift .growingArc(.red, lineWidth: 4) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.