A simple yet customizable horizontal and vertical picker view

Overview

WheelPicker

Version Swift 4.2.x

TheMindStudios

A simple yet customizable horizontal and vertical picker view

Features

  • Vertical or Horizontal picker
  • Image or Text data
  • Configure UILabel & UIImageView
  • Flat & 3D style
  • Custom mask
  • Configure fisheye factor

Example Example

Usage

  1. Import WheelPicker module to your ViewController class
import WheelPicker
  1. Instantiate and set delegate and dataSource as you know. Configure WheelPicker if need
picker.dataSource = self
picker.delegate = self

2.1. Configure WheelPicker if need

picker.interitemSpacing = 25.0
picker.fisheyeFactor = 0.001
picker.style = .style3D
picker.isMaskDisabled = false
picker.scrollDirection = .vertical

picker.textColor = UIColor.blue.withAlphaComponent(0.5)
picker.highlightedTextColor = UIColor.blue
  1. then specify the number of items using WheelPicker methods
func numberOfItems(_ wheelPicker: WheelPicker) -> Int
  1. Specify contents to be shown. You can use either texts or images
optional func titleFor(_ wheelPicker: WheelPicker, _ index: Int) -> String
optional func imageFor(_ wheelPicker: WheelPicker, _ index: Int) -> UIImage
func wheelPicker(_ wheelPicker: WheelPicker, configureLabel label: UILabel, at index: Int) {
   
   label.textColor = UIColor.black.withAlphaComponent(0.5)
   label.highlightedTextColor = UIColor.black
   label.backgroundColor = UIColor.init(hue: CGFloat(index)/CGFloat(flags.count) , saturation: 1.0, brightness: 1.0, alpha: 1.0)
}
  • Using both texts and images are currently not supported. When you implement both, titleFor(_ wheelPicker: WheelPicker, at index: Int) will be called and the other won't.
  • You currently cannot specify image sizes; WheelPicker shows the original image in its original size. Resize your images in advance if you need.
  1. Optional: You can use WheelPicker method to observe selection changes
func wheelPicker(_ wheelPicker: WheelPicker, didSelectItemAt index: Int)

Installation with CocoaPods

To install via CocoaPods add this lines to your Podfile. You need CocoaPods v. 1.1.0 or higher

$ gem install cocoapods

Podfile

To integrate WheelPicker into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target 'TargetName' do
  pod 'WheelPicker', '~> 1.0'
end

Then, run the following command:

$ pod install

License

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

You might also like...
Elegant and Easy-to-Use iOS Swift Date Picker
Elegant and Easy-to-Use iOS Swift Date Picker

D2PDatePicker Example To run the example project, clone the repo, and run pod install from the Example directory first. Example Code: Programmatical I

Multi-picker for iOS and Mac available in SwiftUI
Multi-picker for iOS and Mac available in SwiftUI

Multi-picker for iOS and Mac available in Swift UI

iOS/macOS media picker for importing images and videos in SwiftUI

iOS/macOS media picker for importing images and videos in SwiftUI.

Date picker dialog for iOS
Date picker dialog for iOS

DatePickerDialog 4.0 - iOS - Swift DatePickerDialog is an iOS drop-in classe that displays an UIDatePicker within an UIAlertView. Requirements DatePic

MICountryPicker is a country picker controller for iOS8+ with an option to search.
MICountryPicker is a country picker controller for iOS8+ with an option to search.

MICountryPicker MICountryPicker is a country picker controller for iOS8+ with an option to search. The list of countries is based on the ISO 3166 coun

A drop in single image picker.

PHSingleImagePicker A low memory, single image picker wrapper that provide a significant smaller file size while also preserve high image quality. Int

React-native-place-picker: Pick any place with single click 🚀
React-native-place-picker: Pick any place with single click 🚀

React-native-place-picker: Pick any place with single click 🚀

A SwiftUI implementation of a picker that also allows direct input.
A SwiftUI implementation of a picker that also allows direct input.

ComboPicker ComboPicker is a SwiftUI view that allows users to input a value by selecting from a predefined set or by typing a custom one. Installatio

🔸 A customizable alternative to UIPickerView in Swift.
🔸 A customizable alternative to UIPickerView in Swift.

PickerView PickerView is an easy to use and customize alternative to UIPickerView written in Swift. It was developed to provide a highly customizable

Comments
  • Swift 4 NSFontAttributeName error

    Swift 4 NSFontAttributeName error

    The updated code in Swift needs to look like this:

    let size =  string.size(withAttributes: [NSAttributedStringKey.font: font])
            let highlightedSize = string.size(withAttributes: [NSAttributedStringKey.font: highlightedFont])
    

    Currently it's failing due to Swift 4 API changes.

    opened by Jeehut 0
  • How to proportionally display the images inside the container?

    How to proportionally display the images inside the container?

    I am trying to figure out how to make sure the images are container proportionally within the container. Currently all the images over-exceed the container and it is a mess. Any tips?

    opened by yashjain27 0
  • Add support for SwiftPM-based dependency managers

    Add support for SwiftPM-based dependency managers

    This adds a very basic SwiftPM manifest file to be compatible with any dependency manager that uses Apples official way of specifying libraries.

    Note that I created this PR because I'm currently developing a dependency manager called Accio which is intended to fix several issues with Carthage and fill the gap between now and the time, when Apple adds official support for SwiftPM into Xcode. Merging this will also prepare for that bright future.

    opened by Jeehut 0
  • If item at Index 0 is selected or scrolled to, it is not highlighted.

    If item at Index 0 is selected or scrolled to, it is not highlighted.

    When a wheelpicker set to current index of 0 is displayed, the item/title at that number is not highlighted. if the index is anything other than 0, then highlighting works correctly.

    opened by ghost 0
Releases(1.0.1)
Owner
Mind Studios
We are a team of Mobile and Web Architects that creates products which turn into brands.
Mind Studios
A SwiftUI List Picker to replace system Picker in List

BetterListPicker An alternative customizable list picker in order to replace built-in non customizable Picker when we write settings view codes. Demo

Jinya 1 Apr 11, 2022
A better SwiftUI Picker Use _Picker instead of Picker

BetterPicker A better SwiftUI Picker. Use _Picker instead of Picker. Create styles with _PickerStyle. The is a WIP This library is currently a work-in

Eric Lewis 17 Dec 14, 2022
FYPhoto is a photo/video picker and image browser library for iOS written in pure Swift. It is feature-rich and highly customizable to match your App's requirements.

FYPhoto is a photo/video picker and image browser library for iOS written in pure Swift. It is feature-rich and highly customizable to match your App's requirements.

null 10 Dec 11, 2022
LocationPicker - A ready for use and fully customizable location picker for your app

LocationPicker A ready for use and fully customizable location picker for your app. Features Installation Cocoapods Carthage Swift Package Manager Qui

Zhuoran 397 Nov 16, 2022
a picker view shown as a popup for iOS in Objective-C

CZPicker Demo Change Log 3 most recent changes are listed here. Full change logs v0.4.3 - 2016-08-12 Added - (void)czpickerViewWillDisplay:(CZPickerVi

Chen Zeyu 527 Oct 2, 2022
An iOS picker view to serve all your "picking" needs

Mandoline The PickerView is a UICollectionView that provides a smooth "picking" interface. In order to get the most out of it, a consuming view contro

Blue Apron 883 Nov 28, 2022
A country picker view controller for iOS

Planet A country picker view controller for iOS. Installation CocoaPods You can use CocoaPods to install Planet by adding it to your Podfile: platform

kWallet 71 Jul 11, 2022
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

Kizito Nwose 459 Dec 27, 2022
🎯 Swift country and phone code Picker

CountryPicker Picker code Swift 3 / 4 / 5. Example To run the example project, clone the repo, and run pod install from the Example directory first. U

null 207 Dec 22, 2022