// Full customization
AKAsyncImage(URL(string: "https://example.com/image.jpg")) { image in
image
.resizable()
.scaledToFill()
.frame(width: 200, height: 200)
.clipShape(Circle())
} placeholder: {
Circle()
.fill(Color.gray.opacity(0.2))
.frame(width: 200, height: 200)
.overlay(ProgressView())
} error: {
Circle()
.fill(Color.red.opacity(0.1))
.frame(width: 200, height: 200)
.overlay(Text("Error"))
}
// Simple usage with defaults
AKAsyncImage(URL(string: "https://example.com/image.jpg"))
.frame(width: 150, height: 150)
.clipShape(RoundedRectangle(cornerRadius: 20))
// Custom content only
AKAsyncImage(URL(string: "https://example.com/avatar.jpg")) { image in
image
.resizable()
.aspectRatio(contentMode: .fill)
}
.frame(width: 100, height: 100)
.clipShape(Circle())// Remote images carousel
let imageURLs = [
URL(string: "https://example.com/image1.jpg"),
URL(string: "https://example.com/image2.jpg"),
URL(string: "https://example.com/image3.jpg")
]
AKInfinityCarouselView(
source: .remote(imageURLs),
interval: 3.0,
overlayColor: .black.opacity(0.5)
)
.frame(height: 300)
.clipShape(RoundedRectangle(cornerRadius: 20))
// Local images carousel
AKInfinityCarouselView(
source: .local(["banner1", "banner2", "banner3"]),
interval: 2.5
)
.frame(height: 200)
.ignoresSafeArea(edges: .top)