DropDown alternatives and similar libraries
Based on the "UI" category.
Alternatively, view DropDown alternatives based on common mentions on social networks and blogs.
-
Charts
Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart. -
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 -
folding-cell
:octocat: 📃 FoldingCell is an expanding content cell with animation made by @Ramotion -
NVActivityIndicatorView
A collection of awesome loading animations -
LTMorphingLabel
[EXPERIMENTAL] Graceful morphing effects for UILabel written in Swift. -
FSPagerView
FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders. -
JTAppleCalendar
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable -
SwiftMessages
A very flexible message bar for iOS written in Swift. -
Alerts Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date... -
AMScrollingNavbar
Scrollable UINavigationBar that follows the scrolling of a UIScrollView -
Macaw
Powerful and easy-to-use vector graphics Swift library with SVG support -
SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps. -
TextFieldEffects
Custom UITextFields effects inspired by Codrops, built using Swift -
SwipeCellKit
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. -
Pagemenu
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram) -
SPPermission
Universal API for request permission and get its statuses. -
Scrollable-GraphView
An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift. -
SideMenu
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less. -
Material Components for iOS
[In maintenance mode] Modular and customizable Material Design UI components for iOS -
PermissionScope
A Periscope-inspired way to ask for iOS permissions. -
NotificationBanner
The easiest way to display highly customizable in app notification banners in iOS -
Instructions
Create walkthroughs and guided tours (coach marks) in a simple way, with Swift. -
ActiveLabel
UILabel drop-in replacement supporting Hashtags (#), Mentions (@) and URLs (http://) written in Swift -
ESTabBarController
:octocat: ESTabBarController is a Swift model for customize UI, badge and adding animation to tabbar items. Support lottie! -
TLYShyNavBar
Unlike all those arrogant UINavigationBar, this one is shy and humble! Easily create auto-scrolling navigation bars! -
SlideMenuControllerSwift
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift. -
PKHUD
A Swift based reimplementation of the Apple HUD (Volume, Ringer, Rotation,…) for iOS 8. -
Siren
Notify users when a new version of your app is available and prompt them to upgrade. -
PopupDialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style. -
StarWars.iOS
This component implements transition animation to crumble view-controller into tiny pieces. -
Persei
Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift -
KMNavigationBarTransition
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically. -
DGElasticPullToRefresh
Elastic pull to refresh for iOS developed in Swift -
Whisper
:mega: Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside -
CircleMenu
:octocat: ⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion -
PaperOnboarding
:octocat: PaperOnboarding is a material design UI slider. Swift UI library by @Ramotion -
XLActionController
Fully customizable and extensible action sheet controller written in Swift -
RazzleDazzle
A simple keyframe-based animation framework for iOS, written in Swift. Perfect for scrolling app intros.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of DropDown or a related project?
README
[DropDown](Screenshots/logo.png)
A Material Design drop down for iOS written in Swift.
[[](Screenshots/1.png)](Screenshots/1.png) [[](Screenshots/2.png)](Screenshots/2.png) [[](Screenshots/3.png)](Screenshots/3.png)
Demo
Do pod try DropDown
in your console and run the project to try a demo.
To install CocoaPods, run sudo gem install cocoapods
in your console.
Installation 📱
DropDown
supports Swift 5.0 since version 2.3.13
.
DropDown
supports Swift 4.2 since version 2.3.4
.
If you need Swift 4.0, use version 2.3.2:
- Manually: use tag
2.3.2
- CocoaPods:
pod 'DropDown', '2.3.2'
- Carthage:
github "AssistoLab/DropDown" == 2.3.2
CocoaPods
Use CocoaPods.
- Add
pod 'DropDown'
to your Podfile. - Install the pod(s) by running
pod install
. - Add
import DropDown
in the .swift files where you want to use it
Carthage
Use Carthage.
- Create a file name
Cartfile
. - Add the line
github "AssistoLab/DropDown"
. - Run
carthage update
. - Drag the built
DropDown.framework
into your Xcode project.
Source files
A regular way to use DropDown in your project would be using Embedded Framework. There are two approaches, using source code and adding submodule.
Add source code:
- Download the latest code version.
- Unzip the download file, copy
DropDown
folder to your project folder
Add submodule
- In your favorite terminal,
cd
into your top-level project directory, and entering the following command:bash $ git submodule add [email protected]:AssistoLab/DropDown.git
After you get the source code either by adding it directly or using submodule, then do the following steps:
- Open
DropDown
folder, and dragDropDown.xcodeproj
into the file navigator of your app project, under you app project. - In Xcode, navigate to the target configuration window by clicking the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.
- Open "Build Phases" panel in the tab bar at the top of the window, expend the "Target Dependencies" group and add
DropDown.framework
under DropDown icon in the popup window by clicking+
. Similarly, you can also addDropDown.framework
in "Embedded Binaries" under "General" tab.
Basic usage ✨
let dropDown = DropDown()
// The view to which the drop down will appear on
dropDown.anchorView = view // UIView or UIBarButtonItem
// The list of items to display. Can be changed dynamically
dropDown.dataSource = ["Car", "Motorcycle", "Truck"]
Optional properties:
// Action triggered on selection
dropDown.selectionAction = { [unowned self] (index: Int, item: String) in
print("Selected item: \(item) at index: \(index)")
}
// Will set a custom width instead of the anchor view width
dropDownLeft.width = 200
Display actions:
dropDown.show()
dropDown.hide()
Important ⚠️
Don't forget to put:
DropDown.startListeningToKeyboard()
in your AppDelegate
's didFinishLaunching
method so that the drop down will handle its display with the keyboard displayed even the first time a drop down is showed.
Advanced usage 🛠
Direction
The drop down can be shown below or above the anchor view with:
dropDown.direction = .any
With .any
the drop down will try to displa itself below the anchor view when possible, otherwise above if there is more place than below.
You can restrict the possible directions by using .top
or .bottom
.
Offset
By default, the drop down will be shown onto to anchor view. It will hide it.
If you need the drop down to be below your anchor view when the direction of the drop down is .bottom
, you can precise an offset like this:
// Top of drop down will be below the anchorView
dropDown.bottomOffset = CGPoint(x: 0, y:(dropDown.anchorView?.plainView.bounds.height)!)
If you set the drop down direction to .any
or .top
you can also precise the offset when the drop down will shown above like this:
// When drop down is displayed with `Direction.top`, it will be above the anchorView
dropDown.topOffset = CGPoint(x: 0, y:-(dropDown.anchorView?.plainView.bounds.height)!)
Note the minus sign here that is use to offset to the top.
Cell configuration
Formatted text
By default, the cells in the drop down have the dataSource
values as text.
If you want a custom formatted text for the cells, you can set cellConfiguration
like this:
dropDown.cellConfiguration = { [unowned self] (index, item) in
return "- \(item) (option \(index))"
}
Custom cell
You can also create your own custom cell, from your .xib file. To have something like this for example: [[](Screenshots/3.png)](Screenshots/3.png)
You can check out a concrete example in the Demo inside this project (go to ViewController.swift
, line 125).
For this you have to:
- Create a [
DropDownCell
](DropDown/src/DropDownCell.swift) subclass (e.g. MyCell.swift)swift class MyCell: DropDownCell { @IBOutlet weak var logoImageView: UIImageView! }
- Create your custom xib (e.g. MyCell.xib) and design your cell view in it
- Link the cell in your xib to your custom class
- At least have a label in your xib to link to the [
optionLabel
](DropDown/src/DropDownCell.swift#L14)IBOutlet
in code (optionLabel
is a property ofDropDownCell
) [[](Screenshots/customCells/links.png)](Screenshots/customCells/links.png) [[](Screenshots/customCells/xib.png)](Screenshots/customCells/xib.png) - Then, you simply need to do this: ```swift let dropDown = DropDown()
// The view to which the drop down will appear on dropDown.anchorView = view // UIView or UIBarButtonItem
// The list of items to display. Can be changed dynamically dropDown.dataSource = ["Car", "Motorcycle", "Truck"]
/*** IMPORTANT PART FOR CUSTOM CELLS ***/ dropDown.cellNib = UINib(nibName: "MyCell", bundle: nil)
dropDown.customCellConfiguration = { (index: Index, item: String, cell: DropDownCell) -> Void in guard let cell = cell as? MyCell else { return }
// Setup your custom UI components cell.logoImageView.image = UIImage(named: "logo_(index)") } /*** END - IMPORTANT PART FOR CUSTOM CELLS ***/
- And you're good to go! 🙆
For a complete example, don't hesitate to check the demo app and code.
### Events
```swift
dropDown.cancelAction = { [unowned self] in
println("Drop down dismissed")
}
dropDown.willShowAction = { [unowned self] in
println("Drop down will show")
}
Dismiss modes
dropDown.dismissMode = .onTap
You have 3 dismiss mode with the DismissMode
enum:
onTap
: A tap oustide the drop down is needed to dismiss it (Default)automatic
: No tap is needed to dismiss the drop down. As soon as the user interact with anything else than the drop down, the drop down is dismissedmanual
: The drop down can only be dismissed manually (in code)
Others
You can manually (pre)select a row with:
dropDown.selectRow(at: 3)
The data source is reloaded automatically when changing the dataSource
property.
If needed, you can reload the data source manually by doing:
dropDown.reloadAllComponents()
You can get info about the selected item at any time with this:
dropDown.selectedItem // String?
dropDown.indexForSelectedRow // Int?
Customize UI 🖌
You can customize these properties of the drop down:
textFont
: the font of the text for each cells of the drop down.textColor
: the color of the text for each cells of the drop down.selectedTextColor
: the color of the text for selected cells of the drop down.backgroundColor
: the background color of the drop down.selectionBackgroundColor
: the background color of the selected cell in the drop down.cellHeight
: the height of the drop down cells.dimmedBackgroundColor
: the color of the background (behind the drop down, covering the entire screen).cornerRadius
: the corner radius of the drop down (see info below if you encounter any issue)setupMaskedCorners
: the masked corners of the dropdown. Use this along withcornerRadius
to set the corner radius only on certain corners.
You can change them through each instance of DropDown
or via UIAppearance
like this for example:
DropDown.appearance().textColor = UIColor.black
DropDown.appearance().selectedTextColor = UIColor.red
DropDown.appearance().textFont = UIFont.systemFont(ofSize: 15)
DropDown.appearance().backgroundColor = UIColor.white
DropDown.appearance().selectionBackgroundColor = UIColor.lightGray
DropDown.appearance().cellHeight = 60
Expert mode 🤓
when calling the show
method, it returns a tuple like this:
(canBeDisplayed: Bool, offscreenHeight: CGFloat?)
canBeDisplayed
: Tells if there is enough height to display the drop down. If its value isfalse
, the drop down is not showed.offscreenHeight
: If the drop down was not able to show all cells from the data source at once,offscreenHeight
will contain the height needed to display all cells at once (without having to scroll through them). This can be used in a scroll view or table view to scroll enough before showing the drop down.
Issues
If you experience the compiler error "Ambiguous use of 'cornerRadius'" on line:
DropDown.appearance().cornerRadius = 10
Please use intead:
DropDown.appearance().setupCornerRadius(10) // available since v2.3.6
Requirements
- Xcode 8+
- Swift 3.0
- iOS 8+
- ARC
License
This project is under MIT license. For more information, see LICENSE
file.
Credits
DropDown was inspired by the Material Design version of the Simple Menu.
DropDown was done to integrate in a project I work on:
It will be updated when necessary and fixes will be done as soon as discovered to keep it up to date.
You can find me on Twitter @kevinh6113.
Enjoy!
*Note that all licence references and agreements mentioned in the DropDown README section above
are relevant to that project's source code only.