Latest 0.0.4
License MIT
Platforms ios 8.0
Frameworks UIKit

A simple image slider written in Swift for iOS8 and up, inspired by KIImagePager




1. Pod

include the following line into your podfile

pod EYImageSlider

and run

pod install

2. Mannual

Simply copy EYImageSlider/EYImageSlider.swift to your project


You can create an EYImageSlider either from Storyboard or programatically EYImageSlider()

Create with Storyboard

  1. Drag a UIView into storyboard, and set the UIView Class to EYImageSlider.

  2. Set an outlet for the image slider to the view controller.

    @IBOutlet weak var imageSlider: EYImageSlider!
  3. Set the image slider data source and delegete

    // Set slider data source & delegate
    imageSlider.dataSource = self
    imageSlider.delegate = self
  4. Implement the data source protocol:

    images = [
        NSURL(string: "")!,
        NSURL(string: "")!,
        NSURL(string: "")!
    func arrayWithImages(slider: EYImageSlider) -> [NSURL] {
        return images
  5. Specify the image content mode

    func contentModeForImage(imageIndex: Int, inSlider: EYImageSlider) -> UIViewContentMode {
        return .ScaleAspectFit
  6. Specify the caption for each image [Optional]

    captions =  [
        "Not found"
    func captionForImageAtIndex(imageIndex: Int, inSlider: EYImageSlider) -> String {
        return captions[imageIndex]
  7. Callback when image is tapped.

    func imageSlider(slider: EYImageSlider, didSelectImageAtIndex index: Int) {

For more example, please checkout EYImageSliderDemo project for swift, and EYImageSliderDemo-OC for Objective-C.


imageSlider = EYImageSlider()
imageSlider.frame = CGRect(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height - 44)

imageSlider.dataSource = self
imageSlider.delegate = self

imageSlider.captionTextColor = UIColor.whiteColor()


That is it. Easy? Happy coding…

Latest podspec

    "name": "EYImageSlider",
    "platforms": {
        "ios": "8.0"
    "version": "0.0.4",
    "summary": "EYImageSlider is an widget for you to show a series images like in a slider.",
    "description": "EYImageSlider is a fully customizable widget created for iOS platform to show images in a slider way, it is also support lazy image loading. Developer could also specify the image loading behaviour, eg, using SDWebImage to pull image from remote server.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Enix Yu": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.0.4"
    "source_files": "EYImageSlider/**/*.{h,m,swift}",
    "frameworks": "UIKit",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This