This repository contains a swift iOS project, that uses nyris SDK to take an image, see suggested objects from the image and enable custom cropping.
The project has the following dependencies installed via swift package manager:
- nyris 0.7.1: The main dependency to use nyris SDK, camera management and image manipulation.
- kingfisher: remote image downloading.
This is handled by ImageCaptureController.swift
a subclass of CameraController.swift
which uses nyris CameraManager.swift
to handle Camera permission and setup.
ImageCaptureController
offers the possibility to take a picture, detect objects with nyris API, and send it to Object detection and cropping screen
This is managed by CropController.swift
, This screen will display the previously taken image, and layout the objects that nyris SDK found on the image. If the user clicks on an object, it will provide the possibility to change the object cropping.
Once the user validate the object and its size, the CropController
will find offers and takes the user to results screen.
You can either use the nyris SDK if you wanna use CropController
directly or you can use wrapper arround it called VisualSearchService
that allows you to get both Object detection and Offers at the same time.
The navigation is done with the help of DataTransferProtocol
This is a simple protocol that helps passing data between controllers. You can use your own system.
The project doesn't support localization since every client has their own implementation for localization.
You need a nyris api key and the nyris SDK to be able to use this project. If you want to start the flow:
// use CropController if you want to start from Crop controller
let startingPoint = "ImageCaptureController"
let storyboard = UIStoryboard(name: startingPoint, bundle: Bundle.main)
let captureController = storyboard.instantiateViewController(withIdentifier: startingPoint) as! ImageCaptureController
// If you start with CropController, make sure to pass
// - Image we want to search for
// - List of objects you get from ImageMatchingService's getExtractObjects method
controller.transfer(data: (image:image, offers:offers, boxes:boxes))
// or any other type of navigation
self.navigationController.pushViewController(captureController, animated: false)
You can modify or bring your own product result page.