프로젝트
GitHub에서 보기
JWAutumn/ACarousel
소개
SwiftUI용 캐러셀 뷰 | SwiftUI 캐러셀 효과
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalACarousel
A carousel view for SwiftUI
Table of Contents
Requirements
- iOS 13.0+ / macOS 10.15+ / tvOS 13.0+
- Xcode 11.0+
- Swift 5.1+
Install
Swift Package Manager
Open Xcode, go to File -> Swift Packages -> Add Package Dependency and enter https://github.com/JWAutumn/ACarousel
You can also add ACarousel as a dependency to your Package.swift:
dependencies: [
.package(url: "https://github.com/JWAutumn/ACarousel", from: "0.2.0")
]
Manually
Download and open the project, drag the ACarousel.swift file into your own project.
Usage
- Basic use: The parameters of
ACarouselhave default values, so you can simply pass in the data source and eat it ~
struct Item: Identifiable {
let id = UUID()
let image: Image
}
let roles = ["Luffy", "Zoro", "Sanji", "Nami", "Usopp", "Chopper", "Robin", "Franky", "Brook"]
struct ContentView: View {
let items: [Item] = roles.map { Item(image: Image($0)) }
var body: some View {
ACarousel(items) { item in
item.image
.resizable()
.scaledToFill()
.frame(height: 300)
.cornerRadius(30)
}
.frame(height: 300)
}
}
or:
...
var body: some View {
ACarousel(roles, id: \.self) { name in
Image(name)
.resizable()
.scaledToFill()
.frame(height: 300)
.cornerRadius(30)
}
.frame(height: 300)
}
...
- Customize configuration: You can configure the corresponding parameters to customize the display style according to your needs.
/// ...
struct ContentView: View {
let items: [Item] = roles.map { Item(image: Image($0)) }
var body: some View {
ACarousel(items,
spacing: 10,
headspace: 10,
sidesScaling: 0.7,
isWrap: true,
autoScroll: .active(2)) { item in
item.image
.resizable()
.scaledToFill()
.frame(height: 300)
.cornerRadius(30)
}
.frame(height: 300)
}
}
Example
Download and open ACarouselDemo -> ACarouselDemo.xcodeproj, run and view.
Maintainers
@JWAutumn,@Underthestars-zhy, @Alexander Chapliuk,@thitran-incepit.
Contributing
Feel free to dive in! Open an issue or submit PRs.
License
MIT © JWAutumn
관련 프로젝트 살펴보기
불러오는 중…