- December 17, 2024
- Mins Read
Reel Search is a Swift UI controller that allows you to choose options from a list
specialize in the designing and coding of a custom UI for Mobail Apps and websites.
Stay tuned for the latest updates:
We recommend using CocoaPods to install our library.
Just put this in your Podfile
:
pod ‘RAMReel’
or Carthage users can simply add reel-search
to their Cartfile
:
github “Ramotion/reel-search”
In order to use our control you need to implement the following:
CellClass
: Your cell class must inherit from UICollectionViewCell
and implement the ConfigurableCell
protocol. Or you can just use our predefined class RAMCell
.TextFieldClass
: Any subclass of UITextField
will do.DataSource
: Your type must implement the FlowDataSource
protocol, with QueryType
being String
and ResultType
being Renderable
and Parsable
. Or you can just use our predefined class SimplePrefixQueryDataSource
, which has its ResultType
set to String
.Now you can use those types as generic parameters of type declaration of RAMReel
:
RAMReel<CellClass, TextFieldClass, DataSource>
Next you need to create an instance of RAMReel
, and for that you need the following:
frame: CGRect
: Rect, specifying where you want to put the control.dataSource: DataSource
: the source of data for the reel.placeholder: String
(optional): Placeholder text; by default, an empty string is used.hook: DataSource.ResultType -> Void
(optional): Action to perform on element selection, nil
by default. You can add additional hooks later, if you need multiple actions performed.Let’s use it to create an instance of RAMReel
:
let ramReel = RAMReel<CellClass, TextFieldClass, DataSource>(frame: frame, dataSource: dataSource, placeholder: placeholder, hook: hook)
To add extra actions you may append DataSource.ResultType -> Void
functions to RAMReel
object property hooks
:
ramReel.hooks.append { data in
// your code goes here
}
And the final step, showing RAMReel
on your view:
ramReel.view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
yourView.addSubview(ramReel.view)
If you have visual problems, try calling prepareForViewing
before showing your view.
Like this:
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
ramReel.prepareForViewing()
}
If you want to change RAMReel
look and feel, you can use theming.
To do so, you just to have to implement the Theme
protocol in your class/structure and set your RAMReel
object’s theme
property to your theme.
Or you can just use the predefined instance of type RAMTheme
.
let textColor: UIColor
let listBackgroundColor: UIColor
let font: UIFont
let theme = RAMTheme(textColor: textColor, listBackgroundColor: listBackgroundColor, font: font)
See more at RAMReel docs
A vertical stackview which takes subviews with different widths and adds them to it's rows with paddings, spacings etc.
AudioManager is a Swift package that provides a modular and easy-to-use interface for implementing audio feedback in your applications. It ...