Skip to content
A user-friendly and developer-friendly carousel framework
Swift Objective-C Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ETCarouSwift.xcodeproj folder structure changed Feb 8, 2020
ETCarouSwift folder structure changed Feb 3, 2020
ETCarouSwiftDemo screenshot added Feb 10, 2020
.gitignore initial state Jan 31, 2020
ETCarouSwift.podspec podspec modified Feb 8, 2020
ETCarouSwift_screenshot.jpg screenshot added Feb 10, 2020
LICENSE.md Rename LICENSE to LICENSE.md Feb 8, 2020
Podfile podspec modified Feb 8, 2020
README.md Update README.md Feb 10, 2020

README.md

ETCarouSwift

A user-friendly and developer-friendly carousel framework. ETCarouSwift receives a bunch of images and creates a smooth infinite ride inside the given frame. Dragging is also avaliable along with other handy settings. Simple, light and flawless.

Demo

Click on the screnshot to try an interactive demo by appetize.io

Requirements

  • iOS 13.0+
  • XCode 11.3

Installation

CocoaPods

You can use CocoaPods to install ETCarouSwift by adding it to your Podfile:

# Pods for YourProject

   pod 'ETCarouSwift'

Manually

  1. Download ETCarouSwiftDemo
  2. Drag ETCarouSwift.framework to the root of Your Project
  3. Don't forget to check copy items if needed
  4. Enjoy

Or

  1. Download ETCarouSwift repo
  2. Copy ETCarouSwift folder into YourProject
  3. That's it

Usage

Get started

To get the full benefits import ETCarouSwift wherever you import UIKit

import UIKit
import ETCarouSwift 

Initialize CarouView with desired frame and bunch of images. Set rideDirection as well if needed. Default is .rightToLeft:

let images:[UIImage] = [UIImage(named: "1")!,
                        UIImage(named: "2")!,
                        UIImage(named: "3")!,
                        UIImage(named: "4")!,
                        UIImage(named: "5")!]
                        
 let frame = CGRect(x: 10, y: 100, width: 300, height: 200)
 
 let carouView = CarouView(frame: frame, imageSet: images, rideDirection: .leftToRight)

Add CarouView to the main view:

self.view.addSubview(carouView)

Settings

  1. AutoRide is enabled by default. If you want to cancel it:
carouView.autoRideEnabled = false
  1. Page indicator dot color & current dot color:
carouView.dotColor = UIColor.white
carouView.currentDotColor = UIColor.black
  1. Dot size. Default is .small
carouView.dotSize = .medium
  1. Show time. Default is 2 seconds. Relevant when autoRide is enabled.
carouView.showTime = 3.5

Delegate

Make your controller an inheritor of CarouViewDelegate protocol:

class ViewController:UIViewController, CarouViewDelegate {

Initialize you carouView delegate with your controller property:

carouView.delegate = self

Use two delegate methods:

func carouViewDidChangeImage(_ carouView: CarouView, index currentImageIndex: Int) {
        
    //Do something when image changed
        
}
func carouView(_ carouView: CarouView, didTapImageAt index: Int) {
    
    //Do something on image tap
}

Author

Elena Slovushch

License

This project is licensed under the MIT License - see the LICENSE.md file for details

You can’t perform that action at this time.