Changes

Jump to: navigation, search

A watchOS 2 Complication Tutorial

12 bytes removed, 20:57, 1 February 2016
m
Text replacement - "<google>BUY_WATCHOS2</google>" to "<htmlet>watchos2</htmlet>"
<googlehtmlet>BUY_WATCHOS2watchos2</googlehtmlet>
A number of the methods in the data source class will need to create complication timeline entries. Rather than duplicate code in multiple methods it is more efficient to write a single utility method and call that whenever a timeline entry is needed. This method will be named createTimeLineEntry and will take as parameters the header and body text to be included in the complication and the date of the timeline entry in the form of an NSDate object. The code for the method will also incorporate the beer glass icon into the entry before returning the result in the form of a completed CLKComplicationTimelineEntry object. Within the ComplicationController.swift file, implement this method as follows:
<googlehtmlet>BUY_WATCHOS2watchos2</googlehtmlet>
<pre>
func createTimeLineEntry(headerText: String, bodyText: String, date: NSDate) -> CLKComplicationTimelineEntry {
<googlehtmlet>BUY_WATCHOS2watchos2</googlehtmlet>

Navigation menu