All Projects → cokaholic → Donut

cokaholic / Donut

Licence: mit
Donut is a library for arranging views circularly like a donut.

Programming Languages

swift
15916 projects
swift3
66 projects

Projects that are alternatives of or similar to Donut

Loadingshimmer
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
Stars: ✭ 1,180 (+736.88%)
Mutual labels:  xcode, cocoapods, carthage
Croc
Swift emoji string parsing library
Stars: ✭ 124 (-12.06%)
Mutual labels:  xcode, cocoapods, carthage
Xmlmapper
A simple way to map XML to Objects written in Swift
Stars: ✭ 90 (-36.17%)
Mutual labels:  xcode, cocoapods, carthage
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (-15.6%)
Mutual labels:  xcode, cocoapods, carthage
Alamofire
Elegant HTTP Networking in Swift
Stars: ✭ 36,896 (+26067.38%)
Mutual labels:  xcode, cocoapods, carthage
Luautocompleteview
Highly configurable autocomplete view that is attachable to any UITextField
Stars: ✭ 55 (-60.99%)
Mutual labels:  xcode, cocoapods, carthage
Pluggableappdelegate
!! No longer supported !! A lightweight service-oriented AppDelegate for iOS, made in Swift.
Stars: ✭ 96 (-31.91%)
Mutual labels:  xcode, cocoapods, carthage
Swiftlyext
SwiftlyExt is a collection of useful extensions for Swift 3 standard classes and types 🚀
Stars: ✭ 31 (-78.01%)
Mutual labels:  xcode, cocoapods, carthage
Natrium
A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
Stars: ✭ 131 (-7.09%)
Mutual labels:  xcode, cocoapods, carthage
Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+7492.91%)
Mutual labels:  xcode, cocoapods, carthage
Swiftymessenger
Swift toolkit for passing messages between iOS apps and extensions.
Stars: ✭ 48 (-65.96%)
Mutual labels:  xcode, cocoapods, carthage
Shari
Shari is the alternative to the library of UIPickerView(drum roll) in Swift. You can select a item using UITableView.
Stars: ✭ 111 (-21.28%)
Mutual labels:  xcode, cocoapods, carthage
Swiftysound
SwiftySound is a simple library that lets you play sounds with a single line of code.
Stars: ✭ 995 (+605.67%)
Mutual labels:  xcode, cocoapods, carthage
Corenavigation
📱📲 Navigate between view controllers with ease. 💫 🔜 More stable version (written in Swift 5) coming soon.
Stars: ✭ 69 (-51.06%)
Mutual labels:  xcode, cocoapods, carthage
Bfkit Swift
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.
Stars: ✭ 963 (+582.98%)
Mutual labels:  xcode, cocoapods, carthage
Mscircularslider
A fully-featured, powerful circular slider for iOS applications
Stars: ✭ 94 (-33.33%)
Mutual labels:  xcode, cocoapods, circular
Swipemenuviewcontroller
Swipable tab and menu View and ViewController.
Stars: ✭ 926 (+556.74%)
Mutual labels:  cocoapods, carthage, animation-library
Quiver
Validation, searching and filtering made easy for swift.
Stars: ✭ 27 (-80.85%)
Mutual labels:  xcode, cocoapods, carthage
Nextgrowingtextview
📝 The next in the generations of 'growing textviews' optimized for iOS 8 and above.
Stars: ✭ 1,540 (+992.2%)
Mutual labels:  xcode, cocoapods, carthage
Device
Light weight tool for detecting the current device and screen size written in swift.
Stars: ✭ 1,503 (+965.96%)
Mutual labels:  xcode, cocoapods, carthage

Overview

Donut is a library for arranging views circularly like a donut.

You can use it so easily, and it will be a wonderful experience for you.

This library is inspired by
EMCarousel.

Contents

Features

Platform Cocoapods Carthage compatible License Swift pod

  • [x] Animated item selection
  • [x] Add items with animation
  • [x] Support auto cell alignment center
  • [x] Support 3D inclination angle (x, z)
  • [x] Support animation curve (linear, easeInOut, easeIn, easeOut)
  • [x] Support Interface Builder
  • [x] Support Swift3
  • [x] And more...

Run example app in your browser

Usage

1. Frame Size And Center Diff

It is better to set frame of a UIViewController's view to frame of the donutView.
If you want to move center point of the donutView, please use setCenterDiff(CGPoint(x: #X_Diff, y: #Y_Diff)).

2. Set Configures

Inclinations

If you want to change the inclinations of DonutView, please use setCarouselInclination(angleX: #AngleX, angleZ: #AngleZ).
You can change it about X and Z angles.

#AngleX = -.pi / 8.0 #AngleZ = -.pi / 4.0
x-pi_8 z-pi_4

Cells Alpha

If you want to change the alpha of front or back DonutViewCells, please use setFrontCellAlpha(#AlphaFront) or setBackCellAlpha(#AlphaBack).

#AlphaFront = 1.0, #AlphaBack = 0.7 #AlphaFront = 0.7, #AlphaBack = 1.0
f10_b07 f07_b10

Selectable

You can set whether DonutView is selectable or not by setSelectableCell(Bool).
If the cells is selectable, the selected cell is scrolled to the center.

Auto Cell Alignment Center

You can set whether the alignment of DonutView is center or not by setCellAlignmentCenter(Bool).

true false
alignment_center_true alignment_center_false

Back Cells Interaction Enabled

You can set whether the interaction of DonutView's back cells is enable or not by setBackCellInteractionEnabled(Bool).

Only Cells Interaction Enabled

You can set whether the interaction of DonutView is enable only cells or not by setOnlyCellInteractionEnabled(Bool).

Animation Curve

If you want to change the animation curve of DonutView, please use setAnimationCurve(UIViewAnimationCurve).
You can set an animation curve from below list.

public enum UIViewAnimationCurve : Int {

    case easeInOut  // slow at beginning and end

    case easeIn     // slow at beginning

    case easeOut    // slow at end

    case linear
}

3. DonutViewDelegate (if you need)

If you want to know at changed center cell or selected cell, you can use below delegate methods.

optional func donutView(_ donutView: DonutView, didChangeCenter cell: DonutViewCell)
optional func donutView(_ donutView: DonutView, didSelect cell: DonutViewCell)

4. Add Cells

You can add one or more cells inherited from DonutViewCell to DonutView.
Attention Please!: Before adding a cell, you need to set the frame size for the added cell!!!
If you want to add cell, please use addCell(_ cell: DonutViewCell) or addCells(_ cells: [DonutViewCell]).

class ViewController: UIViewController, DonutViewDelegate {
  private let donutView = DonutView()
  
  override func viewDidLoad() {
        super.viewDidLoad()
        
        donutView.frame = view.bounds                   // It's better
        donutView.setCenterDiff(CGPoint(x: 0, y: 0))    // Set center diff
        donutView.setFrontCellAlpha(1.0)                // Set front cells alpha
        donutView.setBackCellAlpha(0.7)                 // Set back cells alpha
        donutView.setSelectableCell(true)               // Set selectable
        donutView.setCellAlignmentCenter(true)          // Set auto cell alignment center
        donutView.setBackCellInteractionEnabled(false)  // Set back cells interaction
        donutView.setOnlyCellInteractionEnabled(true)   // Set only cells interaction
        donutView.setAnimationCurve(.linear)            // Set animation curve
        donutView.addCells(getCardCells())              // Add cells

        donutView.delegate = self                       // Set delegate
        view.addSubview(donutView)
  }
  
  // MARK: - DonutViewDelegate

  func donutView(_ donutView: DonutView, didChangeCenter cell: DonutViewCell) {
      print("current center cell: \(cell)")
  }

  func donutView(_ donutView: DonutView, didSelect cell: DonutViewCell) {
      print("selected cell: \(cell)")
  }
}

See Example, for more details.

Requirements

  • Xcode 8.0+
  • Swift 3.0+
  • iOS 9.0+

Installation

CocoaPods

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

pod "Donut"

Carthage

Add the following line to your Cartfile:

github "cokaholic/Donut"

Manually

Add the Donut directory to your project.

Author

Keisuke Tatsumi

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].