Coder Social home page Coder Social logo

mrandika / example-app-ios Goto Github PK

View Code? Open in Web Editor NEW

This project forked from particle-iot/example-app-ios

0.0 1.0 0.0 13.23 MB

Barebones example Swift iOS app demonstrating how to use the ParticleSetup / SDK cocoapod libraries

License: GNU Lesser General Public License v3.0

Swift 79.56% Ruby 1.67% Objective-C 18.77%

example-app-ios's Introduction

iOS Example App

Barebones Swift iOS app showcasing basic ParticleSetup / Particle-SDK cocoapods usage / getting started.

Built using XCode 9.4.1 (Swift 4)

How to run the example?

  1. Clone this repo
  2. Open shell window and navigate to project folder
  3. Run pod install
  4. Open ios-app-particle-setup.xcworkspace and run the project on selected device or simulator

How was it created?

  1. Open XCode. File->New->Project->Single View App->Your project name
  2. Create Podfile with your target name and Particle pods reference (see file)
  3. Close XCode Project
  4. Open shell window and navigate to the project folder
  5. Run pod install (make sure your have latest Cocoapods installed), pods will be installed and new XCode workspace file will be created.
  6. in XCode open the new <your project name>.xcworkspace
  7. Add bridging header - see file Particle-Bridging-Header.h for reference.
  8. Go to project settings->build settings->Objective-C bridging header->type in ./<your project name folder>/Particle-Bridging-Header.h (or wherever file is located).
  9. Create the source code and storyboard for your app (see ViewController.swift and Main.storyboard for reference)
  10. Build and run - works on simulator and device (no need to do any modifications to Keychain settings)
  11. Click "Start setup" on the phone and onboard a new Photon to your account.

Code

ViewController invoking Particle setup must adhere to the ParticleSetupMainControllerDelegate protocol and implement (at least) the funcion func particleSetupViewController(_ controller: ParticleSetupMainController!, didFinishWith result: ParticleSetupMainControllerResult, device: ParticleDevice!).

To invoke setup:

if let setupController = ParticleSetupMainController()
{
    setupController.delegate = self //as! UIViewController & ParticleSetupMainControllerDelegate
    self.present(setupController, animated: true, completion: nil)
}

To reference the Particle cloud use: ParticleCloud.sharedInstance(), to reference a device use: var device : ParticleDevice or use a returned device instance from a cloud function like:

if device != nil
{
    device.getVariable("test", completion: { (value, err) -> Void in
        print(value)
    })
}

For questions - refer to Particle mobile knowledgebase/community here: https://community.particle.io/c/mobile

Good luck!

example-app-ios's People

Contributors

idokleinman avatar raimundassakalauskas avatar

Watchers

James Cloos avatar

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.