Awesome
<a href="https://www.ramotion.com/agency/app-development/?utm_source=gthb&utm_medium=repo&utm_campaign=reel-search"><img src="https://github.com/Ramotion/folding-cell/blob/master/header.png"></a>
<a href="https://github.com/Ramotion/reel-search"> <img align="left" src="https://github.com/Ramotion/reel-search/blob/master/reel-search.gif" width="480" height="360" /></a> <p><h1 align="left">REEL SEARCH</h1></p> <h4>Reel Search is a Swift UI controller that allows you to choose options from a list</h4><p><h6>We specialize in the designing and coding of custom UI for Mobile Apps and Websites.</h6> <a href="https://www.ramotion.com/agency/app-development/?utm_source=gthb&utm_medium=repo&utm_campaign=reel-search"> <img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a> </p> <p><h6>Stay tuned for the latest updates:</h6> <a href="https://goo.gl/rPFpid" > <img src="https://i.imgur.com/ziSqeSo.png/" width="156" height="28"></a></p> </br>
RAMReel
Requirements
- iOS 8.0+
- Swift 4.0
Installation
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"
Usage
In order to use our control you need to implement the following:
Types
CellClass
: Your cell class must inherit fromUICollectionViewCell
and implement theConfigurableCell
protocol. Or you can just use our predefined classRAMCell
.TextFieldClass
: Any subclass ofUITextField
will do.DataSource
: Your type must implement theFlowDataSource
protocol, withQueryType
beingString
andResultType
beingRenderable
andParsable
. Or you can just use our predefined classSimplePrefixQueryDataSource
, which has itsResultType
set toString
.
Now you can use those types as generic parameters of type declaration of RAMReel
:
RAMReel<CellClass, TextFieldClass, DataSource>
Values
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)
Adding action hooks
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
}
Putting on the view
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()
}
Theming
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)
Docs
See more at RAMReel docs
<br>📄 License
Reel Search is released under the MIT license. See LICENSE for details.
This library is a part of a <a href="https://github.com/Ramotion/swift-ui-animation-components-and-libraries"><b>selection of our best UI open-source projects.</b></a>
If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com
📱 Get the Showroom App for iOS to give it a try
Try this UI component and more like this in our iOS app. Contact us if interested.
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=reel-search&mt=8" > <img src="https://github.com/ramotion/gliding-collection/raw/master/app_store@2x.png" width="117" height="34"></a> <a href="https://www.ramotion.com/agency/app-development/?utm_source=gthb&utm_medium=repo&utm_campaign=reel-search"> <img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a> <br> <br>