• Stars
    star
    582
  • Rank 76,801 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

animated-tab-bar

:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion
Swift
11,119
star
2

folding-cell

:octocat: πŸ“ƒ FoldingCell is an expanding content cell with animation made by @Ramotion
Swift
10,219
star
3

expanding-collection

:octocat: ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion
Swift
5,551
star
4

folding-cell-android

:octocat: πŸ“ƒ FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion
Java
4,902
star
5

swift-ui-animation-components-and-libraries

Swift UI libraries, iOS components and animations by @Ramotion
Swift
3,680
star
6

circle-menu

:octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion
Swift
3,437
star
7

paper-onboarding

:octocat: PaperOnboarding is a material design UI slider. Swift UI library by @Ramotion
Swift
3,320
star
8

paper-switch

:octocat: 🎚 RAMPaperSwitch is a Swift material design UI module which paints over the parent view when the switch is turned on. iOS library by @Ramotion
Swift
2,935
star
9

paper-onboarding-android

:octocat: PaperOnboarding is a material design slider made by @Ramotion
Java
2,559
star
10

reel-search

:octocat: πŸ” RAMReel is a UI controller that allows you to choose options from a list. Swift UI library made by @Ramotion
Swift
2,537
star
11

cardslider-android

:octocat: πŸƒ Cardslider is a material design UI controller that allows you to swipe through cards with pictures and accompanying descriptions.
Java
2,348
star
12

navigation-stack

:octocat: NavigationStack is a stack-modeled UI navigation controller. Swift UI library made by @Ramotion
Swift
2,308
star
13

preview-transition

:octocat: PreviewTransition is a simple preview gallery UI controller with animated tranisitions. Swift UI library made by @Ramotion
Swift
2,084
star
14

android-ui-animation-components-and-libraries

Android UI libraries, components and animations by @ramotion
Java
2,068
star
15

adaptive-tab-bar

:octocat: AdaptiveController is a 'Progressive Reduction' Swift UI module for adding custom states to Native or Custom iOS UI elements. Swift UI component by @Ramotion
Swift
2,033
star
16

expanding-collection-android

:octocat: ExpandingCollection is a material design card peek/pop controller. Android UI Library made by @Ramotion
Java
2,022
star
17

fluid-slider

:octocat:πŸ’§ A slider widget with a popup bubble displaying the precise value selected. Swift UI library made by @Ramotion
Swift
1,970
star
18

circle-menu-android

:octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Android UI library made by @Ramotion
Java
1,889
star
19

garland-view-android

:octocat: ≑ GarlandView seamlessly transitions between multiple lists of content. Made by @Ramotion
Java
1,838
star
20

aquarelle

:octocat: 🎨 Aquarelle is a watercolor effect component. Javascript library by @Ramotion
JavaScript
1,801
star
21

gliding-collection

:octocat: Gliding Collection is a smooth, flowing, customizable decision for a UICollectionView Swift Controller. iOS library made by @Ramotion
Swift
1,530
star
22

fluid-slider-android

:octocat:πŸ’§ A slider widget with a popup bubble displaying the precise value selected. Android library made by @Ramotion
Kotlin
1,424
star
23

cardslider

:octocat: πŸƒ Cardslider is a design UI controller that allows you to swipe through cards with pictures and accompanying descriptions.
Swift
1,271
star
24

elongation-preview

:octocat: ElongationPreview is an elegant UI push-pop style view controller. iOS library made by @Ramotion
Swift
898
star
25

navigation-toolbar-android

:octocat: Navigation toolbar is a slide-modeled UI navigation controller made by @Ramotion
Kotlin
820
star
26

navigation-toolbar

:octocat: Navigation toolbar is a slide-modeled UI navigation controller made by @Ramotion
Swift
595
star
27

react-native-circle-menu

:octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Reactnative library made by @Ramotion
JavaScript
589
star
28

direct-select-android

:octocat: ≑ DirectSelect is a selection widget with an ethereal, full-screen modal popup displaying the available choices when the widget is interact with.
Java
532
star
29

garland-view

:octocat: ≑ GarlandView seamlessly transitions between multiple lists of content. Swift UI library made by @Ramotion
Swift
501
star
30

showroom

Swift
167
star
31

vr-menu-demo

Prototype of a menu system in Virtual Reality. Javascript VR library made by @Ramotion
JavaScript
124
star
32

iOS-design-tips

Simple iOS design guidelines that will assist you in selecting the dimensions for your AppStore assets:
HTML
78
star
33

blob-menu

Swift
45
star
34

react-native-expanding-collection

JavaScript
37
star
35

showroom-android

Java
28
star
36

utopia

Swift
15
star
37

animations-web

JavaScript
9
star
38

react-native-fluid-slider

5
star
39

distorsion-blur

Swift
2
star