https://github.com/whatthenathan/unlimitedcarousel
🍂 Highly customized Carousel Figure for iOS developed in Swift
https://github.com/whatthenathan/unlimitedcarousel
cocoapods framework swift3
Last synced: 2 months ago
JSON representation
🍂 Highly customized Carousel Figure for iOS developed in Swift
- Host: GitHub
- URL: https://github.com/whatthenathan/unlimitedcarousel
- Owner: WhatTheNathan
- License: bsd-2-clause
- Created: 2018-02-04T07:54:41.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-06T15:47:53.000Z (almost 8 years ago)
- Last Synced: 2025-02-20T04:48:25.627Z (about 1 year ago)
- Topics: cocoapods, framework, swift3
- Language: Swift
- Homepage:
- Size: 18.8 MB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UnlimitedCarousel
[](http://cocoapods.org/pods/UnlimitedCarousel)
[](http://cocoapods.org/pods/UnlimitedCarousel)
[]()
[](http://cocoapods.org/pods/UnlimitedCarousel)
[](#)
Highly customized Carousel Figure for iOS developed in Swift
## Overview
## Requirements
* iOS 9.0+
* Xcode 9
* Swift 3.2
* SnapKit && SDWebImage
## Installation
### CocoaPods
`UnlimitedCarousel` is avaliable through CocoaPods.
Add a pod entry for `UnlimitedCarousel` to your Podfile:
```
pod 'UnlimitedCarousel'
```
Install InfiniteCarousel into your project:
```
pod install
```
## Usage
The only thing you need to do is import `UnlimitedCarousel`, create an instance and add it to your `View` via code or StoryBoard, and conform to it's datasource and delegate.
```swift
import UnlimitedCarousel
```
```swift
let carousel = UnlimitedCarousel(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 160))
carousel.delegate = self
carousel.dataSource = self
self.view.addSubview(carousel)
```
Just implement dataSource and delegate.
### dataSource
**Note: number of sections in UnlimitedCarousel is the key to create the infinite effect, 3 or 5 is recommended**.
```swift
extension ViewController: UnlimitedCarouselDataSource {
func numberOfSections(in carousel: UnlimitedCarousel) -> Int {
return 3
}
func numberOfFigures(for carousel: UnlimitedCarousel) -> Int {
return itemArray.count
}
func titleForFigure(at indexPath: ICIndexPath, in carousel: UnlimitedCarousel) -> String {
return itemArray[indexPath.row].title
}
func picLinkForFigure(at indexPath: ICIndexPath, in carousel: UnlimitedCarousel) -> URL {
return URL(string: itemArray[indexPath.row].picture_url)!
}
}
```
### Delegate
```swift
extension ViewController: UnlimitedCarouselDelegate {
func infiniteCarousel(_ carousel: UnlimitedCarousel, didSelectFigureAt indexPath: ICIndexPath) {
let item = itemArray[indexPath.row]
let url = item.link
let webVC = WebViewController()
webVC.webUrl = URL(string: url)
webVC.navigationItem.title = item.title
self.navigationController?.pushViewController(webVC, animated: true)
}
}
}
```
## Customization
```swift
let carousel = UnlimitedCarousel(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 160))
carousel.pageControl.currentPageIndicatorTintColor =
carousel.pageControl.tintColor =
carousel.hidesForSinglePage =
// titleLabel
carousel.isTitleHidden = false // Default is true
carousel.config = self
extension ViewController: TitleLabelConfig {
func fontForTitleLabel() -> UIFont? {
return UIFont.systemFont(ofSize: 14, weight: UIFontWeightSemibold)
}
func colorForTitleLabel() -> UIColor? {
return UIColor.blue
}
func backgroundColorForTitleLabel() -> UIColor? {
return UIColor.brown
}
}
```
## Todo
- [ ] customized PageControl
- [ ] Not longer dependent on `SnapKit` and `SDWebImage`
## Change Log
* v1.4.0 stable version 1.0
* v1.4.2 add Optional TitleLabel
## Contacts
via email: [@NathanLiu](http://nathanliuyolo@gmail.com)
## License
`UnlimitedCarousel` is released under the [BSD 2-Clause "Simplified" License](LICENSE). See LICENSE for details.