A Modern Horizontal Option Selector View for SwiftUI

Overview

SwiftUISelector

A perfect option picker. Great for navigation. Simple to use.

Example 1 Usage with SwiftUIPager

Try it out with @fermoya's package SwiftUIPager!

Swift Package Manager

SwiftUISelector is available through Swift Package Manager.

Add it to an existing Xcode project as a package dependency:

  1. From the File menu, select Swift Packages › Add Package Dependency…
  2. Enter "https://github.com/p-larson/SwiftUISelector" into the package repository URL text field

or

Copy and Paste SwiftUIPager.swift into your project!

Features

  • Smooth Selection
  • User Control
  • Dynamic Options
  • Simple Animations

Requirements

  • iOS 14, macOS 10.15
  • Swift 5.3

Initialization

Important to note:

SelectorView<Option, OptionView>: View where Option: Hashable, OptionView: View
  1. Use Strings for Options (Intended Initializer)
// SelectorView(selectedOption: Binding<Int>, options: [String])
SelectorView(
    selectedOption: $selectedOption,
    options: ["Classial", "Star", "Zodiac", "Text Art"]
)
  1. Custom Options and Option View. (This is to give you a lot of freedom to make the SelectorView fit your needs)
/*
    SelectorView(
        selectedOption: Binding<Int>, 
        options: [Option], 
        @ViewBuilder content: @escaping (Option) -> OptionView
    )
 **/
SelectorView(selectedOption: $selectedOption, options: [1, 2, 3, 4]) { (option) in
    Text(option.description)
        .italic()
        .padding()
        .background(
            Rectangle()
            .fill(Color.clear)
            .border(Color.black, width: 2)
            .padding(.bottom, 4)
        )
}
.font(
    .system(
        size: 24,
        weight: Font.Weight.black,
        design: Font.Design.monospaced
    )
)

License

I'm not good with legal stuff, use my code as you wish, feel free to keep the credit tag in the code, idk.

Open Source, do what ever you want. Maybe follow me on Instagram I guess.

You might also like...
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

Modern-collection-view - Modern collection view for swift

Modern collection view Sample application demonstrating the use of collection vi

AppLove - View iOS app reviews in multiple selected territories with translation option.

App Love Note: Swift Version 2.2 currently, will update to Swift 3/XCode 8 after cocoapods are updated to Swift 3. Features View iOS Customer App Revi

A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.

DTPagerController This is a control for iOS written in Swift. DTPagerController is simple to use and easy to customize. Screenshots Default segmented

A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.

DTPagerController This is a control for iOS written in Swift. DTPagerController is simple to use and easy to customize. Screenshots Default segmented

Useful for showing text or custom view tags in a vertical or horizontal scrollable view and support Autolayout at the same time
Useful for showing text or custom view tags in a vertical or horizontal scrollable view and support Autolayout at the same time

Useful for showing text or custom view tags in a vertical or horizontal scrollable view and support Autolayout at the same time. It is highly customizable that most features of the text tag can be configured.

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

Updater option for Chromium-legacy

Chromium Updater A tiny updater option for Chromium-legacy. features check/notify updates colored status icon represents updates available download th

Simple side option menu with clean code princibles
Simple side option menu with clean code princibles

SwiftUISideMenu Simple side option menu with clean code princibles.

Set `Open using Rosetta` option on Xcode easily
Set `Open using Rosetta` option on Xcode easily

xcode-arch A utility to switch running architecture of Xcode on M1 mac. Motivation Currently, there is no way to toggle Open using Rosetta option othe

Horizontal and Vertical collection view for infinite scrolling that was designed to be used in SwiftUI
Horizontal and Vertical collection view for infinite scrolling that was designed to be used in SwiftUI

InfiniteScroller Example struct ContentView: View { @State var selected: Int = 1 var body: some View { InfiniteScroller(direction: .ve

App store style horizontal scroll view
App store style horizontal scroll view

ASHorizontalScrollView App store style horizontal scroll view It acts similar to apps sliding behaviours in App store. There are both Objective-C (do

A flexible collection view with proper horizontal layout flow
A flexible collection view with proper horizontal layout flow

FlexCollection A very simple flexible collection view using SwiftUI that automat

Swift-HorizontalPickerView - Customizable horizontal picker view component written in Swift for UIKit/iOS

Horizontal Picker View Customizable horizontal picker view component written in

A simple yet customizable horizontal and vertical picker view
A simple yet customizable horizontal and vertical picker view

WheelPicker A simple yet customizable horizontal and vertical picker view Features Vertical or Horizontal picker Image or Text data Configure UILabel

A horizontal scroll dial like Instagram.
A horizontal scroll dial like Instagram.

HorizontalDial Preview Requirements iOS 8.0+ Swift 5 Storyboard support Installation CocoaPods use_frameworks! pod "HorizontalDial" Manually To instal

UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.
UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.

MultiSlider UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizo

Owner
Peter Larson
// iOS Cowboy
Peter Larson
A fully customizable iOS Horizontal PickerView library, written in pure swift

ADDatePicker is Horizontal Date Picker Library written in Swift Requirements Communication Installation Usage Demo Customization Credits License Requi

Abhishek Dave 166 Dec 21, 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 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
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
🤯 PickEmoji: A SwiftUI Extension to Pick the Emojis that you wish

?? PickEmoji: A SwiftUI Extension to Pick the Emojis that you wish You can use this library in your projects ?? . You can search the emojis too. Below

Mohammad Yasir 10 Sep 26, 2022
Multi-picker for iOS and Mac available in SwiftUI

Multi-picker for iOS and Mac available in Swift UI

1amageek 5 Jul 12, 2022
iOS/macOS media picker for importing images and videos in SwiftUI

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

Mobile Development Club 13 Dec 30, 2022
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