Skip to content

bryceac/ComboBox

Repository files navigation

Table of Contents

ComboBox

Version: 0.2.1

Author: Bryce Campbell

Copyright: 2021

License: See LICENSE

Description: Library that provides a ComboBox for SwiftUI

Notes

This library was tested on iOS 15 and macOS 12, but the minimum version of iOS needed is iOS 13 and macOS 11.

Version History

0.2.1

Minor patch

Queries that do not match existing items automatically become the selected when added on iOS.

Released July 2022

0.2

Allow user to specify the number of items displayed on macOS, and try to get the Combobox to stay static.

Released July 2022

0.1.1

change add button label to image, as recommended by aheze for the main UI of an app I use this library in.

Released April 2022

0.1

Initial release.

</dl>

Importing

Due to this package being meant for only iOS and macOS, importing via Swift Package Manager is not supported, though nothing stops you from trying.

Instead, use XCode to import the package into your project and link the framework to the necessary target(s).

Creating a ComboBox

Using this package, a ComboBox view can be creating by something as simple as this:

ComboBox(choices&amp;&#35;58&#59; $choices, value&amp;&#35;58&#59; $selection)

To allow the user to manipulate the possible choices, as well as keep track of the user's choice, both of which are Binding value types.

On iOS, this will function liker a Picker, which will direct you to a new view that allows filtering and adding items to the list.

On macOS, this will add an NSComboBox to the view, with case insensitive autocompletion and also adds custom values to the list of selectable options, unlike the default implementation.

If you want to specify the number of items to display at a time in a mac application, you can utilize the following:

ComboBox(choices&amp;&#35;58&#59; $choices, value&amp;&#35;58&#59; $selection, itemsToDisplay&amp;&#35;58&#59; 10)

Contributing

If you would like to help make this library better by fixing bugs or adding features, feel free to fork this project and make a pull request.

Support

As this is the first SwiftUI library that I made and SwiftUI is still relatively new at this point, I will try to help out the best that I can, provided you give me enough details.

If you do need help, contact me at the following address:

[email protected]

About

ComboBox for SwiftUI

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages