List a collection of items in a horizontally scrolling view. A scaling factor controls the size of the items relative to the center.

Overview

CAROUSEL

List a collection of items in a horizontally scrolling view. A scaling factor controls the size of the items relative to the center.


We specialize in the designing and coding of custom UI for Mobile Apps and Websites.

Stay tuned for the latest updates:

💡 🏞 Inspired by Kevin Gautier shot

CocoaPods CocoaPods Twitter

Donate

Requirements

  • iOS 12.0+
  • Xcode 10.2+
  • Swift 5.0+

Installation

Just add the CircularCarousel directory to your project.

or use CocoaPods with Podfile:

pod 'CircularCarousel'

or just drag and drop the CircularCarousel directory to your project

Usage

1 Create a custom view that will be used as a carousel item. In this tutorial we will just use a blank UIView.

2 Create a view controller or container view that handles datasource and delegate responses for the contained Carousel.

final class ContainerView : UITableViewCell, CircularCarouselDataSource, CircularCarouselDelegate {

}

2.1 Add a reference to the carousel control and the selection of a delegate and datasource to your Carousel control.

private weak var _carousel : CircularCarousel!

@IBOutlet var carousel : CircularCarousel! {
    set {
        _carousel = newValue
        _carousel.delegate = self
        _carousel.dataSource = self
    }
        
    get {
        return _carousel
    }
}

3 Implement the DataSource and Delegate functions. Some of the key functions are listed below.

3.1 Datasource

func numberOfItems(inCarousel carousel: CircularCarousel) -> Int {
    return /* Number of carousel items */
}
func carousel(_: CircularCarousel, viewForItemAt indexPath: IndexPath, reuseView view: UIView?) -> UIView {
    var view = view as? UIVIew

    if view == nil {
    	view = UIView(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
    }

    return view
}
func startingItemIndex(inCarousel carousel: CircularCarousel) -> Int {
    return /* Insert starting item index */
}

3.2 Delegate

Select how you want the carousel to operate based on the control variables specified below :

func carousel<CGFloat>(_ carousel: CircularCarousel, valueForOption option: CircularCarouselOption, withDefaultValue defaultValue: CGFloat) -> CGFloat {
	switch option {
    case .itemWidth:
        return /* Select item width for carousel */
    /*  Insert one of the following handlers :
	case spacing
	case fadeMin
	case fadeMax
	case fadeRange
	case fadeMinAlpha
	case offsetMultiplier
	case itemWidth
	case scaleMultiplier
	case minScale
	case maxScale
    */
    default:
        return defaultValue
    }
}

Handle the selection of a particular carousel item :

func carousel(_ carousel: CircularCarousel, didSelectItemAtIndex index: Int) {
    /* Handle selection of the selected carousel item */
}

Handle will begin scrolling :

func carousel(_ carousel: CircularCarousel, willBeginScrollingToIndex index: Int) {

}

To handle spacing between items depending on their offst from the center :

func carousel(_ carousel: CircularCarousel, spacingForOffset offset: CGFloat) -> CGFloat {        
    return /* Based on the offset from center, adjust the spacing of the item */
}

That's it, the Carousel is good to go!

📄 License

Carousel is released under the MIT license. See LICENSE for details.

This library is a part of a selection of our best UI open-source projects.

If you use the open-source library in your project, please make sure to credit and backlink to https://www.ramotion.com/

📱 Get the Showroom App for iOS to give it a try

Try this UI component and more like this in our iOS app. Contact us if interested.

Comments
  • Unable to find a specification for `RACarousel`

    Unable to find a specification for `RACarousel`

    Hi I'm on Xcode 10.2.1 and try to install RACarousel using CocoaPods but I encounter this error while installing. Then I search CocoaPods library but I am not able to find RACarousel

    [!] Unable to find a specification for `RACarousel`
    
    You have either:
     * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
     * mistyped the name or version.
     * not added the source repo that hosts the Podspec to your Podfile.
    
    Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
    
    opened by thunpisit 5
  • Doesn't work at all!

    Doesn't work at all!

    Falls on:

    numberOfVisibleItems = Int(ceil(width / itemWidthWithSpacing)) + 2
    

    The following callback method is even not called:

    func carousel<CGFloat>(_ carousel: CircularCarousel, valueForOption option: CircularCarouselOption, withDefaultValue defaultValue: CGFloat) -> CGFloat {
    	    switch option {
    ...
    }
    

    Maybe it is because I added carousel programmatically and with constraints

    opened by Gargo 4
  • Initial Version with Merged Histories

    Initial Version with Merged Histories

    The initial project has been merged with the history from the original private repository.

    Additional work has included making sure the project is running as a Framework and links to a demo project. The framework is a separate project to the demo workspace.

    opened by realityworks 1
  • Update Readme

    Update Readme

    Changes:

    • Add language syntax
    • Fix space for code
    • Indicate list with bold. Example: 2.1

    P.S. It small update. For best experience need update Usage struct. For example use headers (or other way)

    opened by ivanvorobei 0
  • Items Do Not Appear

    Items Do Not Appear

    I sincerely dont know how this library works. I have looked at the documentation and even started dissecting the example/model project to get if the documentation missed something.

    I use a plain UIView as items, set backgroudcolor to orange to see them (replaced the model's items with the exact same UIViews to make sure that I am doing this correctly).

    I set up a new class that inherits UITableViewCell, CircularCarouselDataSource and CircularCarouselDelegate. I add the references to the carousel like in the documentation and example. And I implemented the DataSource and Delegate again like the documentation and the example but I still dont get to see any of the items. The container/uitablecell that holds the items exists but the items do not. Is there something that I am missing?

    One thing to note that I am doing differently is that I am not utilizing a storyboard and instead implementing the entire project programmatically.

    opened by gonzalj3 0
  • How do you display multiple items on screen at the same time?

    How do you display multiple items on screen at the same time?

    My number of items is 5. visibleItems is 3. Width of the main item is 50%. My expectation is to see the side of the other items on the left and right of the main one but, nope. Any advice here? Thanks

    opened by zackshapiro 1
  • heightForRowAt on main table view issue

    heightForRowAt on main table view issue

    hello,

    im trying to modify the sample provided.

    in the sample, there is the main table view contains 3 rows 0, 1 the buttons carousel, 2 the scrolling table "tableCarousel".

    the main table heightForRowAt predefined the scrolling table "tableCarousel" row to fit all of the 10 items of tableCarousel.

    now after I load data I changed the tableCarousel items to 5 but the main table heightForRowAt still predefined to 10 items and that's make a large white space.

    i tried many solutions, I can't update the main heightForRowAt to fit my new data in realtime so i need to reload data and its not an option because reload data reset everything, the 5 tableCarousel too. how to achieve a flexible size of the 3rd-row "tableCarousel" so it can fit whatever data i pass to it ???

    please help and if you didn't get my problem please tell me I could explain more.

    opened by mhdjazmati 2
Owner
Ramotion
UI Engineering, UI/UX Design and Front-End Development Agency
Ramotion
BWMCoverView is a very easy to use advertising the carousel view, supports circular scrolling functions such as switching, asynchronous loading of images, animation, custom is very high.

BWMCoverView BWMCoverView is a very easy to use advertising the carousel view, supports circular scrolling functions such as switching, asynchronous l

Bi Weiming 31 Mar 10, 2021
This library is for adding animation to iOS tabbar items, which is inherited from UITabBarController.

This library is for adding animation to iOS tabbar items, which is inherited from UITabBarController. Installation Just add the Sources folder to your

Yuşa Doğru 162 Jan 6, 2023
ChainPageCollectionView A custom View with two level chained collection views and fancy transition animation

ChainPageCollectionView A custom View with two level chained collection views and fancy transition animation. Demo Requirements iOS 9.0+ Xcode 8 Insta

Yansong Li 775 Dec 7, 2022
Paul Veillard 4 Mar 31, 2022
A collection of animations for iOS. Simple, just add water animations.

DCAnimationKit A collection of animations for iOS Simply, just add water! DCAnimationKit is a category on UIView to make animations easy to perform. E

Dalton 797 Sep 23, 2022
SamuraiTransition is an open source Swift based library providing a collection of ViewController transitions featuring a number of neat “cutting” animations.

SamuraiTransiton is a ViewController transition framework in Swift. It is an animation as if Samurai cut out the screen with a sword. transition types

hachinobu 273 Dec 29, 2022
A collection of bugs present in the SwiftUI beta.

Gosh Darn Bugs! GoshDarnBugs is a collection of... you guessed it, bugs. Usage Clone the repository. Open GoshDarnBugs.xcodeproj Click Run. Why? Swift

SwiftUIX 33 Aug 28, 2021
A collection of small SwiftUI sample projects.

Simple SwiftUI is a small but growing collection of iOS projects designed to provide small sample projects for SwiftUI learners to read, learn from, m

Paul Hudson 557 Dec 28, 2022
VCore is a Swift collection containing objects, functions, and extensions that I use for all my projects

VCore Table of Contents Description Library Structure Architecture Gateway Demo Installation Versioning Contact Description VCore is a Swift collectio

Vakhtang Kontridze 33 Nov 22, 2022
This repo contains swift collection of gui, games, menu, animations, music, payment, etc... for iOS, macOS, watchOS and tvOS

Swift-Collections About: This repo contains a collection of projects built using swift and objective-c Contains projects for macOS iOS iPad watchOS tv

Krisna Pranav 6 Nov 15, 2022
Inspired by Fabric - Answers animation. Allows to "build" given view with pieces. Allows to "destroy" given view into pieces

ADPuzzleAnimation Whats inside Custom animation for UIView inspired by Fabric - Answers animation. Easy to use To create your first animation you need

Anton 126 Dec 25, 2022
A Swift library to take the power of UIView.animateWithDuration(_:, animations:...) to a whole new level - layers, springs, chain-able animations and mixing view and layer animations together!

ver 2.0 NB! Breaking changes in 2.0 - due to a lot of requests EasyAnimation does NOT automatically install itself when imported. You need to enable i

Marin Todorov 3k Dec 27, 2022
Garland View seamlessly transitions between multiple lists of content.

Garland View seamlessly transitions between multiple lists of content. We specialize in the designing and coding of custom UI for Mobile

Ramotion 504 Jul 31, 2022
SwiftUI animated image view that works on iOS and layout just as SwiftUI.Image

SwiftUI.AnimatedImage SwiftUI animated image view that works on iOS and layout just as SwiftUI.Image Screen.Recording.2021-07-31.at.02.18.33.mov Insta

Marcin Krzyzanowski 50 Oct 14, 2022
A library of custom iOS View Controller Animations and Interactions.

RZTransitions is a library to help make iOS7 custom View Controller transitions slick and simple. Installation CocoaPods (Recommended) Add the followi

Rightpoint 1.9k Nov 20, 2022
An easy way to add a simple, shimmering effect to any view in an iOS app.

Shimmer Shimmer is an easy way to add a shimmering effect to any view in your app. It's useful as an unobtrusive loading indicator. Shimmer was origin

Meta Archive 9.4k Dec 26, 2022
CCMRadarView uses the IBDesignable tools to make an easy customizable radar view with animation

CCMRadarView CCMRadarView is a simple to use view that uses the new IBDesignable and IBInspectable features of XCode6 to easily configure the icon in

Carlos Compean 183 Sep 17, 2022
RippleEffectView - A Neat Rippling View Effect

RippleEffectView Not only Uber-like animated screen background. RippleEffectView inspired by RayWenderlich.com article How To Create an Uber Splash Sc

Alex Sergeev 318 Dec 13, 2022
Various view's effects for iOS, written in Swift. Allows you to animate views nicely with easy to use extensions

Various view's effects for iOS, written in Swift. Allows you to animate views nicely with easy to use extensions. Every animation is randomized. Currently supported animations:

Artur Rymarz 23 Aug 23, 2022