Git Product home page Git Product logo

hdaugmentedreality's Introduction

HDAugmentedReality

Augmented Reality component for iOS, written in Swift 2.0. Note: Version 0.1.0 was written in Swift 1.2 so use that for older Xcodes.

Features

  • Fully customisable annotation views
  • Automatic vertical stacking of annotations views
  • Tracks user movement and updates visible annotations
  • Works on all iOS devices(with GPS) and supports all rotations
  • Works with large amount of annotations and on-screen annotation views
  • iOS 7+
  • Easy debugging with map controller
  • Simple and easy to use

Dependencies & Requirements

  • CoreLocation.Framework
  • CoreMotion.Framework
  • MapKit.Framework (For debugging only, can be set ‘Optional’)

Xcode 6.3 is needed for Swift 1.2.

Manual installation (iOS7+)

  • Drag & drop HDAugmentedReality folder from demo project into your project.
  • Add native frameworks listed in “Dependencies & Requirements”
  • iOS 8: Add NSLocationWhenInUseUsageDescription to Info.plist. This is needed for location authorization.

CocoaPods (iOS8+)

  • Works only on iOS8+ because swift pod is built as dynamic framework and dynamic frameworks don't work on iOS7
  • iOS 8: Add NSLocationWhenInUseUsageDescription to Info.plist. This is needed for location authorization.
  • Add this two lines to your podfile:
use_frameworks!
pod 'HDAugmentedReality', :git => 'https://github.com/DanijelHuis/HDAugmentedReality.git'

How to use

Setup controller and provide annotations:

var arViewController = ARViewController()
arViewController.debugEnabled = true
arViewController.dataSource = self
arViewController.maxDistance = 0
arViewController.maxVisibleAnnotations = 100
arViewController.maxVerticalLevel = 5
arViewController.headingSmoothingFactor = 0.05
arViewController.trackingManager.userDistanceFilter = 25
arViewController.trackingManager.reloadDistanceFilter = 75

arViewController.setAnnotations(dummyAnnotations)
self.presentViewController(arViewController, animated: true, completion: nil)

Implement ARDataSource and provide annotation views:

func ar(arViewController: ARViewController, viewForAnnotation: ARAnnotation) -> ARAnnotationView
{
// Annotation views should be lightweight views, try to avoid xibs and autolayout all together.
var annotationView = TestAnnotationView()
annotationView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.5)
annotationView.frame = CGRect(x: 0,y: 0,width: 150,height: 50)
return annotationView;
}

Annotation views must subclass ARAnnotationView. Override bindUi method inside your custom annotation view to set your UI.

Make sure NSLocationWhenInUseUsageDescription is added to your Info.plist file.

License

HDAugmentedReality is released under the MIT license. See LICENSE for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.