A SwiftUI carousel that lays cards along a semi-circular arc with depth, rotation, and swipe-to-select navigation.
- Semi-circular card layout with vertical arc offset
- 2D and 3D rotation for a stacked, physical feel
- Horizontal drag with spring animations
- Circular index wrapping (shortest path around the ring)
- Depth effects on side cards (scale, blur, saturation, brightness)
- Generic over any
Itemtype, or a simplecountinitializer
- iOS 16.0+
- Swift 5.9+
- Xcode 15+ (demo app tested with Xcode 26.x)
In Xcode: File → Add Package Dependencies… and enter your repository URL:
https://github.com/<your-username>/SemiCircularCarousel.git
Choose a version rule (e.g. Up to Next Major from 1.0.0), then add the SemiCircularCarousel library product to your app target.
- File → Add Package Dependencies… → Add Local…
- Select the folder that contains
Package.swift(the repository root). - Add the SemiCircularCarousel product to your target.
dependencies: [
.package(url: "https://github.com/<your-username>/SemiCircularCarousel.git", from: "1.0.0"),
],
targets: [
.target(
name: "YourApp",
dependencies: ["SemiCircularCarousel"]
),
]Import the module and provide card content with a view builder.
import SemiCircularCarousel
import SwiftUI
struct ContentView: View {
var body: some View {
SemiCircularCarousel(count: 5) { index in
RoundedRectangle(cornerRadius: 24)
.fill(.blue.gradient)
.overlay {
Text("Card \(index + 1)")
.font(.title.bold())
.foregroundStyle(.white)
}
}
}
}struct Album: Identifiable {
let id: String
let title: String
}
struct ContentView: View {
let albums: [Album]
var body: some View {
SemiCircularCarousel(items: albums) { album in
AlbumCard(album: album)
}
}
}| Parameter | Default | Description |
|---|---|---|
cardWidth |
220 |
Width of each card |
cardHeight |
350 |
Height of each card |
spacingRatio |
0.92 |
Horizontal spacing as a ratio of width |
SemiCircularCarousel(
count: 5,
cardWidth: 200,
cardHeight: 320,
spacingRatio: 0.9
) { index in
MyCardView(index: index)
}Swipe left or right on the carousel to change the selected card. Drag distance must exceed roughly 42% of the card width to advance.
This repository includes a sample app:
- Open
SemiCircularCarousel.xcodeprojin Xcode. - Select the SemiCircularCarouselDemo scheme.
- Run on an iPhone simulator or device.
The demo lives in SemiCircularCarouselDemo/ and imports the local package from the repo root.
SemiCircularCarousel/
├── Package.swift
├── Sources/
│ └── SemiCircularCarousel/
│ └── SemiCircularCarousel.swift
├── SemiCircularCarouselDemo/
│ └── SemiCircularCarouselApp.swift
└── SemiCircularCarousel.xcodeproj
The Swift package product is SemiCircularCarousel. The demo app target is SemiCircularCarouselDemo so the app module name does not conflict with the library.
Mohd Nafishuddin
This project is licensed under the MIT License — see LICENSE for details.