Skip to content
Permalink
Browse files

First commit of WatchKit extension

  • Loading branch information...
josecastillo committed Aug 9, 2015
1 parent 143342a commit 7e4bc9ae38668343c4d0fa88ada8fa6ea8f267ca

Large diffs are not rendered by default.

@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"screenWidth" : "{130,145}",
"scale" : "2x"
},
{
"idiom" : "watch",
"screenWidth" : "{146,165}",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,23 @@
{
"assets" : [
{
"idiom" : "watch",
"filename" : "Circular.imageset",
"role" : "circular"
},
{
"idiom" : "watch",
"filename" : "Modular.imageset",
"role" : "modular"
},
{
"idiom" : "watch",
"filename" : "Utilitarian.imageset",
"role" : "utilitarian"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"screenWidth" : "{130,145}",
"scale" : "2x"
},
{
"idiom" : "watch",
"screenWidth" : "{146,165}",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"screenWidth" : "{130,145}",
"scale" : "2x"
},
{
"idiom" : "watch",
"screenWidth" : "{146,165}",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,13 @@
//
// ComplicationController.h
// TrainFaceWatchKitApp Extension
//
// Created by Joey Castillo on 8/9/15.
// Copyright © 2015 Panchromatic, LLC. All rights reserved.
//

#import <ClockKit/ClockKit.h>

@interface ComplicationController : NSObject <CLKComplicationDataSource>

@end
@@ -0,0 +1,66 @@
//
// ComplicationController.m
// TrainFaceWatchKitApp Extension
//
// Created by Joey Castillo on 8/9/15.
// Copyright © 2015 Panchromatic, LLC. All rights reserved.
//

#import "ComplicationController.h"

@interface ComplicationController ()

@end

@implementation ComplicationController

#pragma mark - Timeline Configuration

- (void)getSupportedTimeTravelDirectionsForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimeTravelDirections directions))handler {
handler(CLKComplicationTimeTravelDirectionForward|CLKComplicationTimeTravelDirectionBackward);
}

- (void)getTimelineStartDateForComplication:(CLKComplication *)complication withHandler:(void(^)(NSDate * __nullable date))handler {
handler(nil);
}

- (void)getTimelineEndDateForComplication:(CLKComplication *)complication withHandler:(void(^)(NSDate * __nullable date))handler {
handler(nil);
}

- (void)getPrivacyBehaviorForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationPrivacyBehavior privacyBehavior))handler {
handler(CLKComplicationPrivacyBehaviorShowOnLockScreen);
}

#pragma mark - Timeline Population

- (void)getCurrentTimelineEntryForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimelineEntry * __nullable))handler {
// Call the handler with the current timeline entry
handler(nil);
}

- (void)getTimelineEntriesForComplication:(CLKComplication *)complication beforeDate:(NSDate *)date limit:(NSUInteger)limit withHandler:(void(^)(NSArray<CLKComplicationTimelineEntry *> * __nullable entries))handler {
// Call the handler with the timeline entries prior to the given date
handler(nil);
}

- (void)getTimelineEntriesForComplication:(CLKComplication *)complication afterDate:(NSDate *)date limit:(NSUInteger)limit withHandler:(void(^)(NSArray<CLKComplicationTimelineEntry *> * __nullable entries))handler {
// Call the handler with the timeline entries after to the given date
handler(nil);
}

#pragma mark Update Scheduling

- (void)getNextRequestedUpdateDateWithHandler:(void(^)(NSDate * __nullable updateDate))handler {
// Call the handler with the date when you would next like to be given the opportunity to update your complication content
handler(nil);
}

#pragma mark - Placeholder Templates

- (void)getPlaceholderTemplateForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTemplate * __nullable complicationTemplate))handler {
// This method will be called once per supported complication, and the results will be cached
handler(nil);
}

@end
@@ -0,0 +1,13 @@
//
// ExtensionDelegate.h
// TrainFaceWatchKitApp Extension
//
// Created by Joey Castillo on 8/9/15.
// Copyright © 2015 Panchromatic, LLC. All rights reserved.
//

#import <WatchKit/WatchKit.h>

@interface ExtensionDelegate : NSObject <WKExtensionDelegate>

@end
@@ -0,0 +1,26 @@
//
// ExtensionDelegate.m
// TrainFaceWatchKitApp Extension
//
// Created by Joey Castillo on 8/9/15.
// Copyright © 2015 Panchromatic, LLC. All rights reserved.
//

#import "ExtensionDelegate.h"

@implementation ExtensionDelegate

- (void)applicationDidFinishLaunching {
// Perform any final initialization of your application.
}

- (void)applicationDidBecomeActive {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillResignActive {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, etc.
}

@end
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>TrainFaceWatchKitApp Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CLKComplicationPrincipalClass</key>
<string>ComplicationController</string>
<key>CLKComplicationSupportedFamilies</key>
<array>
<string>CLKComplicationFamilyModularSmall</string>
<string>CLKComplicationFamilyModularLarge</string>
<string>CLKComplicationFamilyUtilitarianSmall</string>
<string>CLKComplicationFamilyUtilitarianLarge</string>
<string>CLKComplicationFamilyCircularSmall</string>
</array>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>net.panchromatic.transitapp.watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
</dict>
<key>RemoteInterfacePrincipalClass</key>
<string>InterfaceController</string>
<key>WKExtensionDelegateClassName</key>
<string>ExtensionDelegate</string>
</dict>
</plist>
@@ -0,0 +1,15 @@
//
// InterfaceController.h
// TrainFaceWatchKitApp Extension
//
// Created by Joey Castillo on 8/9/15.
// Copyright © 2015 Panchromatic, LLC. All rights reserved.
//

#import <WatchKit/WatchKit.h>
#import <Foundation/Foundation.h>

@interface InterfaceController : WKInterfaceController
@property (unsafe_unretained, nonatomic) IBOutlet WKInterfaceTable *tableView;

@end
@@ -0,0 +1,45 @@
//
// InterfaceController.m
// TrainFaceWatchKitApp Extension
//
// Created by Joey Castillo on 8/9/15.
// Copyright © 2015 Panchromatic, LLC. All rights reserved.
//

#import "InterfaceController.h"
#import "TFWTrainRow.h"
#import "Constants.h"

@interface InterfaceController()

@end


@implementation InterfaceController

- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];

NSArray *lines = @[@"F", @"M", @"L"];

[self.tableView setNumberOfRows:lines.count withRowType:kCellIdentifierDefault];
for (int i = 0 ; i < self.tableView.numberOfRows ; i++) {
TFWTrainRow *row = [self.tableView rowControllerAtIndex:i];
row.textLabel.text = [NSString stringWithFormat:@"%@: SUSPENDED", lines[i]];
}
}

- (void)willActivate {
// This method is called when watch view controller is about to be visible to user
[super willActivate];
}

- (void)didDeactivate {
// This method is called when watch view controller is no longer visible
[super didDeactivate];
}

@end



@@ -0,0 +1,15 @@
//
// TFWTrainRow.h
// TrainFace
//
// Created by Joey Castillo on 8/9/15.
// Copyright © 2015 Panchromatic, LLC. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <WatchKit/WatchKit.h>

@interface TFWTrainRow : NSObject
@property (unsafe_unretained, nonatomic) IBOutlet WKInterfaceLabel *textLabel;

@end
@@ -0,0 +1,13 @@
//
// TFWTrainRow.m
// TrainFace
//
// Created by Joey Castillo on 8/9/15.
// Copyright © 2015 Panchromatic, LLC. All rights reserved.
//

#import "TFWTrainRow.h"

@implementation TFWTrainRow

@end

0 comments on commit 7e4bc9a

Please sign in to comment.
You can’t perform that action at this time.