Latest 0.1.2
Homepage https://github.com/mozilla-magnet/magnet-scanner-ios
License MPL 2.0
Platforms ios 8.0
Authors

magnet-scanner-ios

License
Carthage compatible

This is an iOS library that you can use in your projects to discover physical web objects around you.

Currently discovers urls based on the following protocols:

  • Bluetooth Low Energy: Discovering both Eddystone and UriBeacon beacons.
  • mDNS: urls advertised via this protocol.

Usage

import Foundation
import MagnetScannerIOS

@objc(MagnetScannerClient)
class MagnetScannerClient: NSObject {
  var scanner: MagnetScanner!;

  override init() {
    super.init();
    scanner = MagnetScanner(callback: onItemFound);
  }

  @objc func start() -> Void {
    scanner.start();
  }

  func onItemFound(item: Dictionary<String, AnyObject>) {
    debugPrint("Item found!");
    scanner.stop();
  }
}

Installation

Carthage

Carthage is a simple, decentralized dependency manager for Cocoa. To
install magnet-scanner-ios with Carthage:

  1. Make sure Carthage is installed.

  2. Update your Cartfile to include the following:

    github "mozilla-magnet/magnet-scanner-ios" ~> 0.1.0
  3. Run carthage update --platform iOS

  4. This is where things start to really differ from CocoaPods. With Carthage,
    you need to manually drag the frameworks over to Xcode. Open your project in
    Xcode and go to Linked Frameworks and Libraries subsection in the General
    section of your projects settings. Now open the Carthage folder in Finder and
    drag the framework in the Build/iOS folder over to Xcode as seen in this GIF:

    screencast-1

  5. Now your Swift code can see these frameworks, but we need to make sure the
    device that the app is running on has them as well.

    • In your project settings, navigate to the Build Phases.

    • Add a New Copy Files Phase.

    • Go down to the Copy Files section.

    • Under Destination select Frameworks.

    • Add the MagnetScannerIOS framework as seen in this GIF:

screencast-2

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. To install
MagnetScannerIOS with CocoaPods:

  1. Make sure the latest CocoaPods is installed.

    # Using the default Ruby install will require you to use sudo when
    # installing and updating gems.
    sudo gem install --pre cocoapods
  2. Create a Podfile by running pod init into your project directory:

  3. Open your Podfile and add MagnetScannerIOS by specifying pod MagnetScannerIOS
    on a single line inside your target block.

    target 'YourApp' do
    pod 'MagnetScannerIOS'
    end
  4. Run pod install.

  5. Close any current Xcode sessions and use YourApp.xcworkspace for your
    project from that point on.

Latest podspec

{
    "name": "MagnetScannerIOS",
    "version": "0.1.2",
    "summary": "This is an iOS library that you can use in your projects to discover physical web objects around you.",
    "description": "This is an iOS library that you can use in your projects to discover physical web objects around you.nnCurrently discovers urls based on the following protocols:nn    Bluetooth Low Energy: Discovering both Eddystone and UriBeacon beacons.n    mDNS: urls advertised via this protocol.",
    "homepage": "https://github.com/mozilla-magnet/magnet-scanner-ios",
    "license": "MPL 2.0",
    "authors": {
        "Fernando Jimu00e9nez Moreno": "[email protected]"
    },
    "social_media_url": "http://twitter.com/f_jimenez",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/mozilla-magnet/magnet-scanner-ios.git",
        "tag": "0.1.2"
    },
    "source_files": "MagnetScannerIOS"
}

Pin It on Pinterest

Share This