### Integrate ClockHandRotationKit via Swift Package Manager Source: https://context7.com/octree/clockhandrotationkit/llms.txt Add the package dependency to your Package.swift file and include it in your target's dependencies. ```swift // In your Package.swift dependencies: dependencies: [ .package(url: "https://github.com/octree/ClockHandRotationKit", from: "1.0.0") ] // Add to your target dependencies: .target( name: "YourApp", dependencies: ["ClockHandRotationKit"] ) ``` -------------------------------- ### Add ClockHandRotationKit via Swift Package Manager Source: https://github.com/octree/clockhandrotationkit/blob/main/README.md Use this dependency in your Xcode project to integrate the ClockHandRotationKit. Ensure you are using a compatible version. ```swift .package(url: "https://github.com/octree/ClockHandRotationKit", from: "1.0.0") ``` -------------------------------- ### Custom Spinner Animation with Period Source: https://context7.com/octree/clockhandrotationkit/llms.txt Creates a spinning animation using a custom rotation period. Useful for loading indicators or decorative elements. Requires importing SwiftUI and ClockHandRotationKit. ```swift import SwiftUI import ClockHandRotationKit struct CustomSpinnerWidget: View { var body: some View { ZStack { // Fast spinner - completes rotation in 5 seconds Image(systemName: "gear") .font(.system(size: 30)) .foregroundColor(.blue) .clockHandRotationEffect(period: .custom(5.0)) // Slower outer ring - completes rotation in 20 seconds Circle() .trim(from: 0, to: 0.25) .stroke(Color.orange, lineWidth: 3) .frame(width: 60, height: 60) .clockHandRotationEffect(period: .custom(20.0)) } } } ``` -------------------------------- ### World Clock Widget with Custom TimeZone and Anchor Source: https://context7.com/octree/clockhandrotationkit/llms.txt Displays a world clock with a specified timezone. Requires importing SwiftUI and ClockHandRotationKit. The hands rotate based on the provided timezone, anchored at the center. ```swift import SwiftUI import ClockHandRotationKit struct WorldClockWidget: View { let timeZone: TimeZone var body: some View { VStack { Text(timeZone.identifier) .font(.caption) ZStack { // Clock face Circle() .stroke(Color.secondary, lineWidth: 1) .frame(width: 60, height: 60) // Hour hand with custom timezone and bottom anchor RoundedRectangle(cornerRadius: 1) .fill(Color.primary) .frame(width: 3, height: 20) .offset(y: -10) .clockHandRotationEffect( period: .hourHand, in: timeZone, anchor: .center ) // Minute hand with custom timezone RoundedRectangle(cornerRadius: 0.5) .fill(Color.primary) .frame(width: 2, height: 25) .offset(y: -12.5) .clockHandRotationEffect( period: .minuteHand, in: timeZone, anchor: .center ) } } } } // Usage in a widget displaying multiple time zones struct MultiTimeZoneView: View { var body: some View { HStack(spacing: 20) { WorldClockWidget(timeZone: TimeZone(identifier: "America/New_York")!) WorldClockWidget(timeZone: TimeZone(identifier: "Europe/London")!) WorldClockWidget(timeZone: TimeZone(identifier: "Asia/Tokyo")!) } } } ``` -------------------------------- ### Gauge Indicator with Custom Rotation Source: https://context7.com/octree/clockhandrotationkit/llms.txt Implements a gauge-style indicator with a custom rotation period and bottom anchor. The needle animates smoothly over a specified duration, suitable for visual readouts. ```swift import SwiftUI import ClockHandRotationKit struct GaugeIndicator: View { var body: some View { ZStack { // Background arc Circle() .trim(from: 0.25, to: 0.75) .stroke(Color.gray.opacity(0.3), lineWidth: 8) .frame(width: 80, height: 80) .rotationEffect(.degrees(90)) // Animated needle - slow 2-minute rotation for demo VStack(spacing: 0) { Triangle() .fill(Color.red) .frame(width: 8, height: 30) Rectangle() .fill(Color.red) .frame(width: 3, height: 10) } .offset(y: -15) .clockHandRotationEffect(period: .custom(120.0), anchor: .bottom) } } } struct Triangle: Shape { func path(in rect: CGRect) -> Path { var path = Path() path.move(to: CGPoint(x: rect.midX, y: rect.minY)) path.addLine(to: CGPoint(x: rect.maxX, y: rect.maxY)) path.addLine(to: CGPoint(x: rect.minX, y: rect.maxY)) path.closeSubpath() return path } } ``` -------------------------------- ### Define ClockHandRotationPeriod Source: https://context7.com/octree/clockhandrotationkit/llms.txt Use the ClockHandRotationPeriod enum to specify standard or custom rotation intervals for clock hands. ```swift import ClockHandRotationKit // Available rotation periods: let secondPeriod = ClockHandRotationPeriod.secondHand // Completes one rotation in 60 seconds let minutePeriod = ClockHandRotationPeriod.minuteHand // Completes one rotation in 60 minutes let hourPeriod = ClockHandRotationPeriod.hourHand // Completes one rotation in 12 hours // Custom rotation period (e.g., 30 seconds for one full rotation) let customPeriod = ClockHandRotationPeriod.custom(30.0) ``` -------------------------------- ### Apply clockHandRotationEffect to SwiftUI Views Source: https://context7.com/octree/clockhandrotationkit/llms.txt Use the clockHandRotationEffect modifier to animate views based on the current time, suitable for analog clock components. ```swift import SwiftUI import ClockHandRotationKit struct AnalogClockWidget: View { var body: some View { ZStack { // Clock face background Circle() .stroke(Color.gray, lineWidth: 2) .frame(width: 100, height: 100) // Hour hand - rotates once every 12 hours Rectangle() .fill(Color.black) .frame(width: 4, height: 25) .offset(y: -12.5) .clockHandRotationEffect(period: .hourHand) // Minute hand - rotates once every 60 minutes Rectangle() .fill(Color.black) .frame(width: 3, height: 35) .offset(y: -17.5) .clockHandRotationEffect(period: .minuteHand) // Second hand - rotates once every 60 seconds Rectangle() .fill(Color.red) .frame(width: 1, height: 40) .offset(y: -20) .clockHandRotationEffect(period: .secondHand) // Center dot Circle() .fill(Color.black) .frame(width: 8, height: 8) } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.