SwiftypeTouch
SwiftypeTouch copied to clipboard
iOS library for Swiftype search and suggest.
⚠️ This repository is deprecated ⚠️
We are no longer maintaining an iOS library for Site Search. However, you can still build excellent native and mobile web experiences with Site Search APIs and clients. Thank you! - Elastic
A first-party iOS library to add Elastic Site Search to iOS applications.
Contents
- Getting started
- FAQ
- Contribute
- License
Getting started 🐣
- Get the code (
git clone [email protected]:swiftype/SwiftypeTouch.git
) and copy the top-levelSwiftypeTouch
directory to the directory that containsYourProject.xcodeproj
(or use a git submodule). - Add
SwiftypeTouch/SwiftypeTouch.xcodeproj
to your Xcode project.- This can be done by dragging and dropping
SwiftypeTouch.xcodeproj
into the project browser from Finder.
- This can be done by dragging and dropping
- In
YourProject.xcodeproj
Build Settings add to yourHEADER_SEARCH_PATHS
the following:$(SRCROOT)/SwiftypeTouch/
. - Add
-ObjC
and-all_load
to your project'sOTHER_LDFLAGS
. - Now make sure to link
libSwiftypeTouch.a
with your target. Under your Target settings go to Build Phases. Expand "Link Binary With Libraries" hit the "+" button and selectlibSwiftypeTouch.a
from the dialog. - Add SwiftypeTouch to the "Target Dependencies" list.
You are now ready to use SwiftypeTouch in your project.
Note: This client has been developed for the Swiftype Site Search API endpoints only. You may refer to the Swiftype Site Search API Documentation for additional context.
Usage
If your Swiftype search engine was created with the Swiftype crawler, you can follow these steps to quickly add search that displays results in a table view. Results will load in a webview when selected.
- First, makes sure you've followed the steps above.
- Add
#import <SwiftypeTouch/STPageDocumentTypeResultsObject.h>
to the view controller implementation that will place the search bar on the screen. - Create a private property for
STPageDocumentTypeResultsObject
calledresultObject
in your view controller:
@property (nonatomic, strong) STPageDocumentTypeResultsObject *resultObject;
- In the view controller's
viewDidLoad
add the following code to get the search bar to appear:
self.resultObject = [[STPageDocumentTypeResultsObject alloc] initWithViewController:self clientEngineKey:@"yourEngineKey"];
[self.view addSubview:self.resultObject.searchBar];
To see an example of this, view the source of the SwiftypeTouchExample application.
FAQ 🔮
Where do I report issues with the client?
If something is not working as expected, please open an issue.
Where can I learn more about Site Search?
Your best bet is to read the documentation.
Where else can I go to get help?
You can checkout the Elastic Site Search community discuss forums.
Contribute 🚀
We welcome contributors to the project. Before you begin, a couple notes...
- Before opening a pull request, please create an issue to discuss the scope of your proposal.
- Please write simple code and concise documentation, when appropriate.
License 📗
Thank you to all the contributors!