If you would like to use the Particle SDK, written by @ido, with an Apple Watch, using an app written in Swift, here are the instructions you will need in order to get the Mobile SDK operating with the WatchKit Extension. With these instructions you will be able to do in a few minutes what took me a looooong time to figure out.
OK, here goes...
I recommend you begin with a fully operational project that has the Particle Mobile SDK working, and deployed, on a phone.
If you are unsure how to add a watchkit to your iOS project, I recommend Ray Wenderlich's tutorial for the WatchKit with Swift. Find it at www.raywenderlich.com
After you have added the WatchKit Target to your working IOS project, if you start adding code before making the following configuration changes, you'll get something like this.
No fun. Can't deploy that!
Quit Xcode, launch terminal and navigate to the project directory that contains your project.
Do a pod update.
This should take care of everything... But no.
Relaunch your project using the xcworkspace file, just as you must with any pod dependency managed project.
Click on the blue main folder for the project. Click on Info. You will see the main project plus four targets below it.
See Configurations in bold. Under Configurations are two entries, Debug and Release. Beside them under Based on Configuration File you will see 1Configuration set.
Expand Debug and Release by clicking on the triangle.
Note in the screenshot above that the Debug WatchKit Extension line is highlighted and I have already added the choice Pods.debug to it. You do that by clicking on the word None, then choosing Pods.debug.
In the WatchKit Extension line under Release, click on None and choose Pods.release
Now your screen should look like this.
Now look at the list of Targets under the main project. Note the Target named WatchKit Extension. Click on that target. Now, at the top of the page, click on the General tab. You should see a screen like this.
Look at the section named Linked Frameworks and Libraries. There are no entries. For curiosities sake, click on the Target for the iPhone app; the first one in the list. You will see there is an entry here, for libPods.a. Go back to the WatchKit Extension target and where you see the + sign at the bottom of the Linked Frameworks and Libraries section, click on it. You will now see this screen. Choose libPods.a
When you have successfully added libPods.a to the WatchKit Target Linked Frameworks and Libraries your screen will look like this
OK! Those are the entries that pod update did not make for you. When you create a base project (iPhone) and do the steps explained in my other posts, the correct entries are made for the base project settings. However, cocoa pods is not currently making the correct settings when a WatchKit Target is present.
Whoopeee! Now you can use the cool Mobile SDK to create a Watch app by adding code to the WatchKit Extension InterfaceController.swift file, as shown below.
There are a few challenges to be surmounted with the Watch. Foremost is that there is no room nor a keyboard to enter login information. You will have to take care of that in your main app, and place it in a shared storage such as NSUserDefaults, or Core Data. That is if you want to deploy the app and make the login information configurable.
If you are just making demos or your own 'Maker' project, you will have to hard code the login and device information (as I did above), if you don't want to create the shared data store.
The Watch apps run entirely on the iPhone (today), but they run in their own 'sandbox'. There is no communication allowed between Watch apps and Phone apps (other than shared data). What does that mean for Watch App creation? Simply that you have to duplicate the code for login, device capture and function call/ variable read for the watch app, in InterfaceController.swift.
I'll be doing a complete Watch app, with shared data store, and putting it on GitHub. I'll post that when its up. Have fun! It sure is fun for me to show people my watch, touch it, and explain what just happened back at my office, and read a variable to prove it. Hope to see @zach geeking out with one of these soon!