Visual Positioning System SDK iOS

Overview

VPS SDK (iOS)

CocoaPods Compatible

This is Visual Positioning System SDK for Native iOS apps. Main features are:

  • High-precision global user position localization for your AR apps
  • Easy to use public API
  • Integration in SceneKit and RealityKit
  • Works both for UIKit and SwiftUI apps

For more information visit our page on SmartMarket. If you want access to other VPS locations or want to scan your own proprerty, please contact us at [email protected].

Requirements

  • iOS 12.0+
  • Xcode 12+
  • Swift 5+
  • ARKit supported device

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate VPS SDK into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
target 'YOUR PROJECT NAME HERE' do
  use_frameworks!
pod 'VPSNMobile'
end

Run pod install from the project directory to create a new workspace file.

From sources

You can also build VPS framework from this repository.

Clone this repository and run pod install from the project directory. A new workspace file will be created. Now you can build VPS framework and link it to your apps.

Examples

There are several example apps included in this repository:

  • ContentPreviewVPS - test VPS service from simulator without visiting the real location
  • ExampleAppVPS - integration of VPS service in a real end-user app

To install an example project, clone this repository. Run pod install from the selected example directory to create a new workspace file.

Usage

User permissions

Add flags to access user's location and camera into info.plist. TemporaryAuth is required for devices running iOS 14+.

<key>NSCameraUsageDescription</key>
    <string></string>
<key>NSLocationWhenInUseUsageDescription</key>
    <string></string>
<key>NSLocationTemporaryUsageDescriptionDictionary</key>
    <dict>
        <key>TemporaryAuth</key>
        <string></string>
    </dict>

UIKit

  • You must define a ARSCNViewDelegate delegate and call the method vps?.frameUpdated() each frame
  • Assign the default configuration using a method getDefaultConfiguration() that will return nil if the device is not supported.
  • You can use the delegate method sessionWasInterrupted to stop the VPS when the application moves foreground and start it again in sessionInterruptionEnded
import VPSNMobile
import UIKit
import ARKit

class Example:UIViewController, ARSCNViewDelegate {
    var arview: ARSCNView!
    var configuration: ARWorldTrackingConfiguration!
    var vps: VPSService?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        arview.scene = SCNScene()
        arview.delegate = self
        if let config = VPSBuilder.getDefaultConfiguration() {
            configuration = config
        } else {
            fatalError()
        }
        
        let set = Settings(
            url: "https://...",
            locationID: "ID",
            recognizeType: .server)
            
        VPSBuilder.initializeVPS(arsession: arview.session,
                                 settings: set,
                                 gpsUsage: false,
                                 onlyForceMode: true,
                                 serialLocalizeEnabled: false,
                                 delegate: nil) { (vps) in
            self.vps = vps
        }
        vps?.start()
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        arview.session.run(configuration)
    }
    
    func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) {
        vps?.frameUpdated()
    }
    
    func sessionWasInterrupted(_ session: ARSession) {
        vps?.stop()
    }
    
    func sessionInterruptionEnded(_ session: ARSession) {
        vps?.start()
    }
}

Mobile VPS

To enable the mobile VPS mode, you need to select it in the settings recognizeType: .mobile. In this case, the neural network will be downloaded to the device, the progress of which can be tracked in the loadingProgress handler. If the model failed to download or could not be initialized, the failure handler will report this.

VPSBuilder.initializeVPS(arsession: arview.session,
                         settings: set,
                         gpsUsage: false,
                         onlyForceMode: true,
                         serialLocalizeEnabled: false,
                         delegate: self) { (serc) in
    self.vps = serc
} loadingProgress: { (pr) in
    print("value",pr)
} failure: { (er) in
    print("err",er)
}

RealityKit

Using RealityKit is similar to using SceneKit. Instead of using func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) you need to use func session(_ session: ARSession, didUpdate frame: ARFrame) using ARSessionDelegate for call call the method vps?.frameUpdated() each frame.

func session(_ session: ARSession, didUpdate frame: ARFrame) {
    
}

SwiftUI

For better use in SwiftUI, you should use the MVVM architecture. Here is a quick example:

struct ContentView: View {
    @StateObject var vm = ViewModel()
    @State var vpsStarted = false
    var body: some View {
    VStack {
        ARView(vm: vm)
            .background(Color.gray)
            .cornerRadius(20)
            .padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10))
        Button(vpsStarted ? "stop" : "start") {
            vpsStarted ? vm.vps?.Stop() : vm.vps?.Start()
            withAnimation(.linear) {
                vpsStarted.toggle()
            }
        }
        .frame(width: 300, height: 50, alignment: .center)
        .background(vpsStarted ? Color.red : Color.green)
        .cornerRadius(20)
        .padding()
    }
    }
}

class ViewModel:NSObject, ObservableObject, ARSCNViewDelegate, VPSServiceDelegate {
    
    var vps: VPSService?
    func initVPS(session:ARSession) {
        let set = Settings(
            url: "...",
            locationID: "...",
            recognizeType: .server)
        VPSBuilder.initializeVPS(arsession: session,
                                 settings: set,
                                 gpsUsage: false,
                                 onlyForceMode: true,
                                 serialLocalizeEnabled: false,
                                 delegate: self) { (vps) in
            self.vps = vps
        } loadingProgress: { (pr) in
        } failure: { (er) in
            print("err",er)
        }
    }
    
    func serialcount(doned: Int) {
        
    }
    
    func positionVPS(pos: ResponseVPSPhoto) {
        print("POS",pos)
    }
    
    func error(err: NSError) {
        
    }
    
    func sending() {
        
    }
}

struct ARView: UIViewRepresentable {
    
    @ObservedObject var vm: ViewModel
    
    func makeUIView(context: Context) -> ARSCNView {
        let sceneView = ARSCNView()
        sceneView.scene = SCNScene(named: "polytechcopy.scn")!
        sceneView.autoenablesDefaultLighting = true
        sceneView.delegate = vm
        vm.initVPS(session: sceneView.session)
        let config = VPSBuilder.getDefaultConfiguration()!
        config.isAutoFocusEnabled = true
        sceneView.session.run(config)
        return sceneView
    }
    
    func updateUIView(_ uiView: ARSCNView, context: Context) {
    }
    
    static func dismantleUIView(_ uiView: ARSCNView, coordinator: ()) {
        uiView.delegate = nil
    }
}
You might also like...
Spotify SDK for iOS
Spotify SDK for iOS

Spotify iOS SDK Overview The Spotify iOS framework allows your application to interact with the Spotify app running in the background on a user's devi

Headless iOS/Mac SDK for saving stuff to Pocket.
Headless iOS/Mac SDK for saving stuff to Pocket.

This SDK is deprecated Howdy all! 👋 Thanks for checking out this repo. Your 👀 mean a lot to us. 💗 Unfortunately, this project is deprecated, and th

Evernote Cloud SDK for iOS
Evernote Cloud SDK for iOS

Evernote Cloud SDK 3.0 for iOS This is the official Evernote SDK for iOS. To get started, follow the instructions bellow. Additional information can b

iOS SDK for the Box Content API
iOS SDK for the Box Content API

Box iOS SDK Getting Started Docs: https://developer.box.com/guides/mobile/ios/quick-start/ NOTE: The Box iOS SDK in Objective-C (prior to v3.0.0) has

OneDrive SDK for iOS

Get started with the OneDrive SDK for iOS Integrate the OneDrive API into your iOS app! 1. Installation Install via Cocoapods Install Cocoapods - Foll

Stripe iOS SDK

Stripe iOS SDK The Stripe iOS SDK makes it quick and easy to build an excellent payment experience in your iOS app. We provide powerful and customizab

AWS SDK for iOS. For more information, see our web site:
AWS SDK for iOS. For more information, see our web site:

AWS SDK for iOS The AWS SDK for iOS provides a library and documentation for developers to build connected mobile applications using AWS. Features / A

Zendesk Mobile SDK for iOS

⚠️ This Repository has been deprecated, please go to here for the Zendesk Support SDK ⚠️ Zendesk Mobile SDK for iOS Zendesk SDK for mobile is a quick,

PlayKit: Kaltura Player SDK for iOS

Kaltura Player SDK Demo: Demo repo. If you are a Kaltura customer, please contact your Kaltura Customer Success Manager to help facilitate use of this

Owner
SberDevices
NLP, речевые технологии, компьютерное зрение, биометрия, нейроинтерфейсы
SberDevices
Px-mobile-sdk-demo-app - PerimeterX Mobile SDK - Demo App

About PerimeterX PerimeterX is the leading provider of application security solu

PerimeterX 1 Nov 20, 2022
Native iOS implementation of RadarCOVID tracing client using DP3T iOS SDK

RadarCOVID iOS App Introduction Native iOS implementation of RadarCOVID tracing client using DP3T iOS SDK Prerequisites These are the tools used to bu

Radar COVID 146 Nov 24, 2022
TelegramStickersImport — Telegram stickers importing SDK for iOS

TelegramStickersImport — Telegram stickers importing SDK for iOS TelegramStickersImport helps your users import third-party programaticaly created sti

null 35 Oct 26, 2022
Muxer used on top of Feed iOS SDK for airplay

FeedAirplayMuxer Muxer used on top of Feed iOS SDK for airplay purposes. Demo Project --> https://github.com/feedfm/AirplayDemo Feed Airplay Muxer is

Feed Media 0 May 6, 2022
Basispay IOS SDK Version 2

BasisPay-IOS-KIT BasisPay IOS Payment Gateway kit for developers INTRODUCTION This document describes the steps for integrating Basispay online paymen

null 0 Oct 21, 2021
Release repo for Gini Bank SDK for iOS

Gini Bank SDK for iOS The Gini Bank SDK provides components for capturing, reviewing and analyzing photos of invoices and remittance slips. By integra

Gini GmbH 1 Dec 6, 2022
Da Xue Zhang Platform Lvb iOS SDK

Cloud_Lvb_SDK iOS API Reference Dxz Meeting iOS SDK是为 iOS 平台用户音视频服务的开源 SDK。通过大学长开放平台自研RTC,RTM系统,为客户提供质量可靠的音视频服务。 类 类名 描述 CLS_PlatformManager SDK的音视频主要

null 8 Jan 10, 2022
PayPal iOS SDK

PayPal iOS SDK Welcome to PayPal's iOS SDK. This library will help you accept card, PayPal, Venmo, and alternative payment methods in your iOS app. Su

PayPal 25 Dec 14, 2022
Unofficial Notion API SDK for iOS & macOS

NotionSwift Unofficial Notion SDK for iOS & macOS. This is still work in progress version, the module interface might change. API Documentation This l

Wojciech Chojnacki 59 Jan 8, 2023
150,000+ stickers API & SDK for iOS Apps.

English | 한국어 Stipop UI SDK for iOS Stipop SDK provides over 150,000 .png and .gif stickers that can be easily integrated into mobile app chats, comme

Stipop, Inc. 19 Dec 20, 2022