HelloGitHub icon indicating copy to clipboard operation
HelloGitHub copied to clipboard

【开源自荐】CardCarousel - 最易用的 iOS 轮播组件

Open YuLeiFuYun opened this issue 1 year ago • 0 comments

  • 项目地址:https://github.com/YuLeiFuYun/CardCarousel

  • 类别:Swift

  • 项目标题:一个功能强大且易于使用的轮播组件,支持使用咒语进行设置

  • 项目描述:CardCarousel 可以让你对轮播进行更精细地控制,你可以设置滚动方向、页面尺寸、页间距、滚动停止时的页面对齐方式、自动滚动时的滚动动画效果、页面过渡效果、分页阈值和手动滚动时的页面减速速率等等。CardCarousel 可以在 UIKit 与 SwiftUI 中使用,支持链式调用,提供了丰富的初始化方法,参数可以通过点语法进行设置。更好的是,CardCarousel 还支持通过咒语进行设置。

  • 亮点:更精细的控制、更好的易用性与咒语

  • 示例代码:

CardCarousel(data: data) { (cell: CustomCell, index: Int, itemIdentifier: Item) in
    cell.imageView.kf.setImage(with: url)
    cell.indexLabel.backgroundColor = itemIdentifier.color
    cell.indexLabel.text = itemIdentifier.index
}
.cardLayoutSize(widthDimension: .fractionalWidth(0.7), heightDimension: .fractionalHeight(0.7))
.cardTransformMode(.liner(minimumAlpha: 0.3))
.cardCornerRadius(10)
.move(to: view)

// 咒语(《高级动物》风格)
CardCarousel(咒语: "矛盾,自私,好色,爱喜,无聊,善良,爱喜 贪婪,真诚 善变,暗淡 无奈,埋怨", 施法材料: data, 作用域: CGRect(x: 0, y: 100, width: 393, height: 200))
    .法术目标(view)

// 效果等同于
CardCarousel(frame: CGRect(x: 0, y: 100, width: 393, height: 200), data: data)
    .cardLayoutSize(widthDimension: .fractionalWidth(0.7), heightDimension: .fractionalHeight(0.7))
    .cardTransformMode(.liner)
    .scrollDirection(.rightToLeft)
    .loopMode(.rollback)
    .move(to: view)
  • 截图: 罗小黑战记

YuLeiFuYun avatar Jan 27 '24 11:01 YuLeiFuYun