Use the "mfp add adapter" command and follow the prompts to create a new Adapter. So, here's how we can create an adapter using the MobileFirst Command Line Interface. Loading data into a WatchKit extension is identical to making a request to the MobileFirst server adapter from a native iOS app, which can be done in either Objective-C or Swift. I added labels for displaying data, and linked them to IBOutlet references in my view controller so I can change their values once the data is loaded. Be sure to check out the WKInterfaceTable class reference for more detail on working with WatchKit tables.įor displaying the details screen, I also used very similar pattern. All of these are straightforward WatchKit development practices. These were connected to IBOutlet references in the view controller class. For each row in the table there are 3 labels to display specific data fields. In the main interface I have a "loading." label (that is hidden once the data is loaded) and a table that is used to display data. One is a table that displays rows of data, one is a details screen which has lots of labels used to display data. I have two views that were built in Interface Builder. So, lets first look at the app interface. Full source code for this project is available at: The User Interface The basic process was this: build out the Apple Watch apps user interface in Xcode/Interface Builder, build the adapters to expose the data, then start consuming the data within the WatchKit extension to deliver it to the watch app interface. The data is simulated, so don't use it for any investments. In the video below I walk through the process of recreating the Apple Watch Stocks app using data delivered from a MobileFirst Platform Foundation server instance. You can write them in either Java or JavaScript, they can be consumed in any MobileFirst app, and they offer security, data transformation, and reporting metrics out of the box. If you aren't familiar with Adapters, they are server-side code that is used to transfer and retrieve information from back-end systems to client applications and cloud services. Since the logic for a WatchKit app is executed in the WatchKit extension, which is actually an executable that runs on the phone, there is no difference between between the two (for WatchOS 1 - the options will be different in WatchOS 2, but the same technique will still apply). consuming data from an Adapter for the Apple Watch is exactly the same as consuming an Adapter in a native iOS project. If you're already familiar with consuming data using MobileFirst Adapters, then guess what. This demonstrates how you can deliver a solution today using WatchOS, and it is also possible to deliver on other wearable platforms platforms including Android Wear using a similar process. In this post I'm going to demonstrate how to consume data from a MobileFirst Adapter to power a recreation of the Stocks app on the Apple Watch. All those great features that the MobileFirst Platform brings to your mobile development process are also easily accessible to your wearable apps, including (but not limited to) data adapters, remote logging, operational analytics, push notification management, and more. Since Apple recently announced they've achieved over $1B in sales with the Apple Watch and taken over 75% of the smartwatch market, I figured a friendly reminder that you can power the Apple Watch (and other wearable platforms) easily, securely, and efficiently with the IBM MobileFirst Platform can't hurt.
0 Comments
Leave a Reply. |