Awesome
Tapster iOS Demo
This demo demonstrates how to use the PredictionIO Swift SDK to integrate an iOS app with a PredictionIO engine to make your mobile app more interesting.
Requirements
- PredictionIO 0.14.0+
- Xcode 11.0+ and iOS 10.0+
- Swift 5+
Demo
Quick Setup
Set up the PredictionIO Engine
- Clone the similar product engine for Tapster iOS
$ git clone https://github.com/minhtule/Tapster-iOS-Demo-Similar-Product-Engine.git tapster-similar-product
- Create a new PredictionIO app and build the engine.
# Need to start HBase and Elasticsearch first
$ pio-start-all
$ pio app new tapster
$ cd tapster-similar-product
$ pio build
Note: If your PredictionIO app is not tapster
, you need to update the appName
field in the engine.json
file with the new app name.
Set up the iOS app
- Install Gemfile
bundle install
- Install CocoaPods dependencies
$ cd ..
# Clone this iOS repo if you haven't done so
$ git clone https://github.com/minhtule/Tapster-iOS-Demo
# Switch to the Xcode project directory
$ cd Tapster-iOS-Demo
$ pod install
Import data and train the engine
- Start the PredictionIO event server.
# Switch back to the engine directory
$ cd ../tapster-similar-product
$ pio eventserver
- Open the iOS project workspace
Tapster iOS Demo.xcworkspace
(created by CocoaPods) in Xcode. We need to add the PredictionIO app's access key to the iOS app'sEventClient
. InDataViewController.swift
,
let eventClient = EventClient(accessKey: "<Your app's access key here>")
Run the simulator. In the home screen, tap Import Data
and then Run Import
button. The whole import will take a while. Check Xcode's debug console to see the progress.
- Now we can train and deploy our engine. In the engine directory, run
# At the engine directory
$ pio train
$ pio deploy
Now the recommendation engine is ready and you can start reading comics! In the app home screen, tap the Start Reading
button. You can then swipe right to like a comic and swipe left to dislike just like in Tinder!
Tutorial
For step-by-step instructions, check out the detailed tutorial.
License
Tapster iOS Demo is released under the MIT license. See LICENSE for details