Convert Figma logo to code with AI

zvonicek logoImageSlideshow

Swift image slideshow with circular scrolling, timer and full screen viewer

1,772
473
1,772
73

Top Related Projects

30,518

A browser automation framework and ecosystem.

18,791

Cross-platform automation framework for all kinds of apps, built on top of the W3C WebDriver protocol

46,847

Fast, easy and reliable testing for anything that runs in a browser.

88,205

JavaScript API for Chrome and Firefox

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

Quick Overview

ImageSlideshow is a Swift-based iOS library that provides an easy-to-use and customizable image slideshow for iOS applications. It supports various input sources, including local and web images, as well as custom input sources, making it versatile for different use cases.

Pros

  • Easy integration with both programmatic and storyboard-based UI development
  • Supports multiple input sources (local images, web images, custom sources)
  • Customizable appearance and behavior (transitions, indicators, gestures)
  • Actively maintained with regular updates and bug fixes

Cons

  • Limited to iOS platform only
  • May require additional setup for advanced features
  • Documentation could be more comprehensive for some advanced use cases
  • Dependency on third-party libraries for certain functionalities

Code Examples

  1. Basic setup with local images:
import ImageSlideshow

let slideshow = ImageSlideshow(frame: CGRect(x: 0, y: 0, width: 300, height: 200))
slideshow.setImageInputs([
    ImageSource(image: UIImage(named: "img1")!),
    ImageSource(image: UIImage(named: "img2")!),
    ImageSource(image: UIImage(named: "img3")!)
])
view.addSubview(slideshow)
  1. Using web images:
import ImageSlideshow
import Kingfisher

let slideshow = ImageSlideshow(frame: CGRect(x: 0, y: 0, width: 300, height: 200))
slideshow.setImageInputs([
    KingfisherSource(urlString: "https://example.com/image1.jpg")!,
    KingfisherSource(urlString: "https://example.com/image2.jpg")!,
    KingfisherSource(urlString: "https://example.com/image3.jpg")!
])
view.addSubview(slideshow)
  1. Customizing appearance:
slideshow.circular = true
slideshow.pageIndicatorPosition = .bottom
slideshow.contentScaleMode = .scaleAspectFill
slideshow.activityIndicator = DefaultActivityIndicator()
slideshow.setCurrentPage(0, animated: false)

Getting Started

  1. Add ImageSlideshow to your project using Swift Package Manager, CocoaPods, or Carthage.
  2. Import the library in your Swift file:
    import ImageSlideshow
    
  3. Create an instance of ImageSlideshow and add it to your view:
    let slideshow = ImageSlideshow(frame: CGRect(x: 0, y: 0, width: 300, height: 200))
    view.addSubview(slideshow)
    
  4. Set image inputs:
    slideshow.setImageInputs([
        ImageSource(image: UIImage(named: "img1")!),
        ImageSource(image: UIImage(named: "img2")!),
        ImageSource(image: UIImage(named: "img3")!)
    ])
    

Competitor Comparisons

30,518

A browser automation framework and ecosystem.

Pros of Selenium

  • Broader scope: Selenium is a comprehensive web automation tool, while ImageSlideshow is focused solely on image slideshows for iOS
  • Multi-language support: Selenium offers bindings for various programming languages, not limited to Swift
  • Extensive community and ecosystem: Being a widely-used tool, Selenium has more resources, plugins, and third-party integrations

Cons of Selenium

  • Complexity: Selenium has a steeper learning curve and more complex setup compared to ImageSlideshow's straightforward implementation
  • Resource intensity: Selenium typically requires more system resources and may be overkill for simple image slideshow functionality
  • iOS-specific features: ImageSlideshow is tailored for iOS development, offering native integration that Selenium lacks

Code Comparison

ImageSlideshow (Swift):

let imageSlideshow = ImageSlideshow(frame: CGRect(x: 0, y: 0, width: 300, height: 200))
imageSlideshow.setImageInputs([
    ImageSource(image: UIImage(named: "myImage"))!,
    ImageSource(image: UIImage(named: "myImage2"))!
])

Selenium (Python):

from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://example.com")
element = driver.find_element_by_id("image-slideshow")
element.click()

While both snippets demonstrate basic usage, they highlight the different focuses of each library: ImageSlideshow for native iOS image presentation, and Selenium for web automation and testing.

18,791

Cross-platform automation framework for all kinds of apps, built on top of the W3C WebDriver protocol

Pros of Appium

  • Broader scope: Appium is a cross-platform automation tool for mobile and web apps, while ImageSlideshow is focused on image slideshows for iOS
  • Larger community and more frequent updates: Appium has over 15k stars and regular commits, indicating active development
  • Supports multiple programming languages: Appium allows test scripts in various languages, not limited to Swift/Objective-C

Cons of Appium

  • Steeper learning curve: Appium's complexity may require more time to master compared to ImageSlideshow's simpler API
  • Resource-intensive: Appium requires more system resources and setup time than a lightweight library like ImageSlideshow
  • Less specialized: Appium's general-purpose nature means it lacks ImageSlideshow's specific optimizations for image slideshows

Code Comparison

ImageSlideshow:

let slideshow = ImageSlideshow(frame: CGRect(x: 0, y: 0, width: 320, height: 200))
slideshow.setImageInputs([
    ImageSource(image: UIImage(named: "myImage"))!,
    ImageSource(image: UIImage(named: "myImage2"))!
])

Appium (Python):

from appium import webdriver

desired_caps = {
    'platformName': 'iOS',
    'deviceName': 'iPhone Simulator',
    'app': '/path/to/your/app.app'
}
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
46,847

Fast, easy and reliable testing for anything that runs in a browser.

Pros of Cypress

  • Comprehensive end-to-end testing framework for web applications
  • Extensive documentation and active community support
  • Built-in debugging tools and real-time reloading

Cons of Cypress

  • Limited to testing web applications, not suitable for mobile or desktop apps
  • Steeper learning curve due to its extensive feature set
  • Requires more setup and configuration compared to simpler image slideshow libraries

Code Comparison

ImageSlideshow (Swift):

let slideshow = ImageSlideshow(frame: CGRect(x: 0, y: 0, width: 320, height: 200))
slideshow.setImageInputs([
    ImageSource(image: UIImage(named: "myImage"))!,
    AlamofireSource(urlString: "https://images.unsplash.com/photo-1432679963831-2dab49187847?w=1080")!
])

Cypress (JavaScript):

describe('Image Slideshow Test', () => {
  it('should navigate through images', () => {
    cy.visit('https://example.com/slideshow')
    cy.get('.slideshow-image').should('be.visible')
    cy.get('.next-button').click()
    cy.get('.slideshow-image').should('have.attr', 'src', 'image2.jpg')
  })
})

While ImageSlideshow focuses on creating and managing image slideshows in iOS applications, Cypress is a comprehensive testing framework for web applications. The code examples demonstrate their different purposes and usage contexts.

88,205

JavaScript API for Chrome and Firefox

Pros of Puppeteer

  • Offers comprehensive browser automation capabilities beyond image slideshows
  • Supports a wide range of web scraping and testing functionalities
  • Provides a powerful API for interacting with web pages programmatically

Cons of Puppeteer

  • Significantly larger and more complex, requiring more setup and resources
  • Not specifically designed for image slideshows, requiring additional implementation
  • Steeper learning curve for developers unfamiliar with browser automation

Code Comparison

ImageSlideshow (Swift):

let slideshow = ImageSlideshow(frame: CGRect(x: 0, y: 0, width: 320, height: 200))
slideshow.setImageInputs([
    ImageSource(image: UIImage(named: "img1")!),
    ImageSource(image: UIImage(named: "img2")!)
])

Puppeteer (JavaScript):

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({path: 'screenshot.png'});
await browser.close();

Summary

ImageSlideshow is a lightweight, iOS-specific library for creating image slideshows, while Puppeteer is a powerful, cross-platform tool for browser automation. ImageSlideshow is easier to use for simple slideshow tasks, but Puppeteer offers more flexibility and features for complex web interactions and testing scenarios.

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

Pros of Playwright

  • Cross-browser automation support (Chromium, Firefox, WebKit)
  • Powerful API for end-to-end testing and web scraping
  • Active development and community support

Cons of Playwright

  • Steeper learning curve for beginners
  • Requires Node.js environment to run
  • Larger project scope and complexity

Code Comparison

ImageSlideshow (Swift):

let slideshow = ImageSlideshow(frame: CGRect(x: 0, y: 0, width: 320, height: 200))
slideshow.setImageInputs([
    ImageSource(image: UIImage(named: "myImage")!),
    AlamofireSource(urlString: "https://images.unsplash.com/photo-1432679963831-2dab49187847?w=1080")
])

Playwright (JavaScript):

const browser = await playwright.chromium.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'screenshot.png' });
await browser.close();

Summary

ImageSlideshow is a lightweight Swift library for creating image slideshows in iOS apps, while Playwright is a comprehensive Node.js library for browser automation and testing. ImageSlideshow is more focused and easier to use for its specific purpose, while Playwright offers broader functionality but with increased complexity.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

🖼 ImageSlideshow

Customizable Swift image slideshow with circular scrolling, timer and full screen viewer

Build Status Version Carthage Compatible License Platform

📱 Example

To run the example project, clone the repo, and run pod install from the Example directory first.

🔧 Installation

CocoaPods

ImageSlideshow is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ImageSlideshow', '~> 1.9.0'

Carthage

To integrate ImageSlideshow into your Xcode project using Carthage, specify it in your Cartfile:

github "zvonicek/ImageSlideshow" ~> 1.9.0

Carthage does not include InputSources for external providers (due to dependency on those providers) so you need to grab the one you need from ImageSlideshow/Classes/InputSources manually.

Manually

One possibility is to download a built framework (ImageSlideshow.framework.zip) from releases page and link it with your project (underLinked Frameworks and Libraries in your target). This is, however, currently problematic because of rapid Swift development -- the framework is built for a single Swift version and may not work on previous/future versions.

Alternatively can also grab the whole ImageSlideshow directory and copy it to your project. Be sure to remove those external Input Sources you don't need.

Note on Swift 2.3, Swift 3 and Swift 4 support

Version 1.4 supports Swift 4. Swift 3 is supported from version 1.0, for Swift 2.2 and Swift 2.3 compatible code use version 0.6 or branch swift-2.3.

🔨 How to use

Add ImageSlideshow view to your view hiearchy either in Interface Builder or in code.

Loading images

Set images by using setImageInputs method on ImageSlideshow instance with an array of InputSources. By default you can use ImageSource which takes UIImage or few other InputSources for most popular networking libraries. You can also create your own input source by implementing InputSource protocol.

LibraryInputSource namePod
AlamofireImageAlamofireSourcepod "ImageSlideshow/Alamofire"
AFNetworkingAFURLSourcepod "ImageSlideshow/AFURL"
SDWebImageSDWebImageSourcepod "ImageSlideshow/SDWebImage"
KingfisherKingfisherSourcepod "ImageSlideshow/Kingfisher"
ParseParseSourcepod "ImageSlideshow/Parse"
slideshow.setImageInputs([
  ImageSource(image: UIImage(named: "myImage"))!,
  ImageSource(image: UIImage(named: "myImage2"))!,
  AlamofireSource(urlString: "https://images.unsplash.com/photo-1432679963831-2dab49187847?w=1080"),
  KingfisherSource(urlString: "https://images.unsplash.com/photo-1432679963831-2dab49187847?w=1080"),
  ParseSource(file: PFFile(name:"image.jpg", data:data))
])

Configuration

Behaviour is configurable by those properties:

  • slideshowInterval - slideshow interval in seconds (default 0 – disabled)
  • zoomEnabled - enables zooming (default false)
  • circular - enables circular scrolling (default true)
  • activityIndicator – allows to set custom activity indicator, see Activity indicator section
  • pageIndicator – allows to set custom page indicator, see Page indicator section; assign nil to hide page indicator
  • pageIndicatorPosition - configures position of the page indicator
  • contentScaleMode - configures the scaling (default ScaleAspectFit)
  • draggingEnabled - enables dragging (default true)
  • currentPageChanged - closure called on page change
  • willBeginDragging - closure called on scrollViewWillBeginDragging
  • didEndDecelerating - closure called on scrollViewDidEndDecelerating
  • preload - image preloading configuration (default all preloading, also fixed)

Page Indicator

Page indicator can be customized using the pageIndicator property on ImageSlideshow. By defualt, a plain UIPageControl is used. If needed, page control can be customized:

let pageIndicator = UIPageControl()
pageIndicator.currentPageIndicatorTintColor = UIColor.lightGray
pageIndicator.pageIndicatorTintColor = UIColor.black
slideshow.pageIndicator = pageIndicator

Also, a simple label page indicator that shows pages in style "5/21" (fifth page from twenty one) is provided:

slideshow.pageIndicator = LabelPageIndicator()

You can also use your own page indicator by adopting the PageIndicatorView protocol.

Position of the page indicator can be configured by assigning a PageIndicatorPosition value to the pageIndicatorPosition property on ImageSlideshow. You may specify the horizontal and vertical positioning separately.

Horizontal positioning options are: .left(padding: Int), .center, .right(padding: Int)

Vertical positioning options are: .top, .bottom, .under, customTop(padding: Int), customBottom(padding: Int), customUnder(padding: Int)

Example:

slideshow.pageIndicatorPosition = PageIndicatorPosition(horizontal: .left(padding: 20), vertical: .bottom)

Activity Indicator

By default activity indicator is not shown, but you can enable it by setting DefaultActivityIndicator instance to Image Slideshow:

slideshow.activityIndicator = DefaultActivityIndicator()

You can customize style and color of the indicator:

slideshow.activityIndicator = DefaultActivityIndicator(style: .white, color: nil)

There's also an option to use your own activity indicator. You just need to implement ActivityIndicatorView and ActivityIndicatorFactory protocols. See ActivityIndicator.swift for more information.

Full Screen view

There is also a possibility to open full-screen image view using attached FullScreenSlideshowViewController. The simplest way is to call:

override func viewDidLoad() {
  let gestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(ViewController.didTap))
  slideshow.addGestureRecognizer(gestureRecognizer)
}

func didTap() {
  slideshow.presentFullScreenController(from: self)
}

FullScreenSlideshowViewController can also be instantiated and configured manually if more advanced behavior is needed.

👤 Author

Petr Zvoníček

📄 License

ImageSlideshow is available under the MIT license. See the LICENSE file for more info.

👀 References

Inspired by projects: