SparkSetup 0.7.0

SparkSetup 0.7.0

LangLanguage Obj-CObjective C
License Apache 2
ReleasedLast Release Mar 2017

Maintained by Ido Kleinman.




Test Targets33
powered by Segment


Pull Requests3


LOCLines of Code 4,137

Particle Device Setup library (beta)

The Particle Device Setup library is meant for integrating the initial setup process of Particle devices in your app. This library will enable you to easily invoke a standalone setup wizard UI for setting up internet-connected products powered by a Particle device (Photon, P0, P1). The setup UI can be easily customized by a customization proxy class, that includes: look & feel, colors, texts and fonts as well as custom brand logos and custom instructional video for your product. There are good defaults in place if you don’t set these properties, but you can override the look and feel as needed to suit the rest of your app.

The wireless setup process for the Photon uses very different underlying technology from the Core. Where the Core used TI SmartConfig, the Photon uses what we call “soft AP” — i.e.: the Photon advertises a Wi-Fi network, you join that network from your mobile app to exchange credentials, and then the Photon connects using the Wi-Fi credentials you supplied.

With the Device Setup library, you make one simple call from your app, for example when the user hits a “Setup my device” button, and a whole series of screens then guide the user through the setup process. When the process finishes, the app user is back on the screen where she hit the “setup my device” button, and your code has been passed an instance of the device she just setup and claimed. iOS Device setup library is implemented as an open-source Cocoapod static library and also as Carthage dynamic framework dependancy. See Installation section for more details. It works well for both Objective-C and Swift projects containing any type of dependencies.

Rebranding notice

Spark has been recently rebranded as Particle. Code currently contains SparkSetup keyword as classes prefixes. this will soon be replaced with ParticleDeviceSetup.



Import SparkSetup.h in your view controller implementation file, use bridging header for Swift projects (See Installation section for more details).


Use #import <ParticleDeviceSetupLibrary/ParticleDeviceSetupLibrary.h> in Obj-C files or import ParticleDeviceSetupLibrary for Swift files.

and then invoke the device setup wizard by:


SparkSetupMainController *setupController = [[SparkSetupMainController alloc] init];
setupController.delegate = self; // why? see "Advanced" section below 
[self presentViewController:setupController animated:YES completion:nil];


if let setupController = SparkSetupMainController()
    setupController.delegate = self
    self.presentViewController(setupController, animated: true, completion: nil)

Alternatively if your app requires separation between the Particle cloud authentication process and the device setup process you can call:


SparkSetupMainController *setupController = [[SparkSetupMainController alloc] initWithAuthenticationOnly:YES];
[self presentViewController:setupController animated:YES completion:nil];


if let setupController = SparkSetupMainController(authenticationOnly: true)
    self.presentViewController(setupController, animated: true, completion: nil)

This will invoke Particle Cloud authentication (login/signup/password recovery screens) only after user has successfully logged in or signed up, control will be returned to the calling app. If an active user session already exists control will be returned immediately.

Configure device Wi-Fi credentials without claiming it

If your app requires the ability to let users configure device Wi-Fi credentials without changing its ownership you can also do that via initWithSetupOnly, and by allowing your users to skip authentication (see allowSkipAuthentication flag in customization section) if you present the authentication stage. If an active user session exists - it'll be used and device will be claimed, otherwise it won't. So invoking setup without an active user session will go thru the setup steps required for configuring device Wi-Fi credentials but not for claiming it. However, calling -initWithSetupOnly: method with an active user session is essentially the same as calling -init:. Usage:


SparkSetupMainController *setupController = [[SparkSetupMainController alloc] initWithSetupOnly:YES];
[self presentViewController:setupController animated:YES completion:nil];


if let setupController = SparkSetupMainController(setupOnly: true)
    self.presentViewController(setupController, animated: true, completion: nil)

Password manager extension support

Starting library version 0.6.0 the 1Password manager extension support has been added to the signup and login screens - no action is required from the developer - if 1Password is installed on the iOS device the lock icon will appear in the password fields on those screen and will allow user to fill in his saved password (login) or create a new one (signup). Only recommendation is adding LSApplicationQueriesSchemes = org-appextension-feature-password-management key-value to your info.plist file in your app project.

For additional information read here.


Customize setup look and feel by accessing the SparkSetupCustomization singleton appearance proxy [SparkSetupCustomization sharedInstance] and modify its default properties. Setting the properties in this class is optional. These properies are shown in Objective-C syntax for convenience but work the same for Swift projects - use String, Bool instead of NSString and BOOL.

Product/brand info:

 NSString *deviceName;                  // Device/product name 
 UIImage *productImage;                 // Custom product image to display in "Get ready" screen *new*
 NSString *brandName;                   // Your brand name
 UIImage *brandImage;                   // Your brand logo to fit in header of setup wizard screens
 UIColor *brandImageBackgroundColor;    // brand logo background color
 NSString *instructionalVideoFilename;  // Instructional video shown landscape full screen mode when "Show me how" button pressed on second setup screen

Technical data:

 NSString *modeButtonName;              // The mode button name on your product
 NSString *listenModeLEDColorName;      // The color of the LED when product is in listen mode
 NSString *networkNamePrefix;           // The SSID prefix of the Soft AP Wi-Fi network of your product while in listen mode

Links for legal/technical info:

 NSURL *termsOfServiceLinkURL;      // URL for terms of service of the app/device usage
 NSURL *privacyPolicyLinkURL;       // URL for privacy policy of the app/device usage

Look & feel:

 UIColor *pageBackgroundColor;     // setup screens background color
 UIImage *pageBackgroundImage;     // optional background image for setup screens
 UIColor *normalTextColor;         // normal text color
 UIColor *linkTextColor;           // link text color (will be underlined)
 UIColor *elementBackgroundColor;  // Buttons/spinners background color
 UIColor *elementTextColor;        // Buttons text color
 NSString *normalTextFontName;     // Customize setup font - include OTF/TTF file in project
 NSString *boldTextFontName;       // Customize setup font - include OTF/TTF file in project
 CGFloat fontSizeOffset;           // Set offset of font size so small/big fonts can be fine-adjusted
 BOOL tintSetupImages;             // This will tint the checkmark/warning/wifi symbols in the setup process to match text color (useful for dark backgrounds)
 BOOL lightStatusAndNavBar;        // Make navigation and status bar appear in white or black color characters to contrast the selected brandImage color // *New since v0.6.1*

Product creators

If you're developing an app for your product / you're a product creator you should set productMode to YES (or true for Swift) - this will enable product mode which uses different API endpoints to allow adding/setting up devices assigned to your product.

If you set productMode to YES / true be sure to also provide the productId (and productName) - please read here about how to find your productId number.

Make sure you inject the SparkCloud class with scoped OAuth credentials for creating customers, so app users could create an account. Read here on how to do it correctly.

 BOOL productMode;              // enable product mode
 NSString *productName;         // product display name 
 NSUInteger productId;            // Product Id number from Particle console

Skipping authentication:

 BOOL allowSkipAuthentication;          // Allow user to skip authentication (skip button will appear on signup and login screens)
 NSString *skipAuthenticationMessage;   // Message to display to user when she's requesting to skip authentication (Yes/No question)


You can get an active instance of the set up device - SparkDevice by making your viewcontroller conform to protocol <SparkSetupMainControllerDelegate> when setup wizard completes successfully:


-(void)sparkSetupViewController:(SparkSetupMainController *)controller didFinishWithResult:(SparkSetupMainControllerResult)result device:(SparkDevice *)device;


func sparkSetupViewController(controller: SparkSetupMainController!, didFinishWithResult result: SparkSetupMainControllerResult, device: SparkDevice!)

method will be called, if (result == SparkSetupMainControllerResultSuccess) or (or simply (result == .Success) in Swift) the device parameter will contain an active SparkDevice instance you can interact with using the iOS Cloud SDK. In case setup failed, aborted or was cancalled you can determine the exact reason by consulting the documentation of the enum value SparkSetupMainControllerResult. See here for additional details.

If setup failed and you can still determine the device ID of the last device that was tried to be setup and failed by conforming to the @optional delegate function: (new since 0.5.0)


- (void)sparkSetupViewController:(SparkSetupMainController *)controller didNotSucceeedWithDeviceID:(NSString *)deviceID;


func sparkSetupViewController(controller: SparkSetupMainController!, didNotSucceeedWithDeviceID deviceID: String)


Cocoapods usage example app (in Swift) can be found here. Example app demonstates - invoking the setup wizard, customizing its UI and using the returned SparkDevice instance once setup wizard completes (delegate). Feel free to contribute to the example by submitting pull requests.


Check out the Reference in Cocoadocs website or consult the javadoc style comments in SparkSetupCustomization.h and SparkSetupMainController.h for each public method or property. If the Device Setup library installation completed successfully in your XCode project - you should be able to press Esc to get an auto-complete hints from XCode for each public method or property in the library.

Requirements / limitations

  • iOS 8.0 and up supported
  • Currently setup wizard displays on portait mode only.
  • XCode 7 and up is required


Support for Swift projects

To use Particle Device Setup library from within Swift based projects - you'll need to configure a bridging header - please read here, as an additional resource you can consult official Apple documentation on the matter.


  • If you need help, use Our community website
  • If you found a bug, and can provide steps to reliably reproduce it, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.


Particle Device Setup library is available under the Apache license 2.0. See the LICENSE file for more info.