add watch extension template

This commit is contained in:
Watson
2014-11-19 21:50:45 +09:00
parent 34313418be
commit ffc591bd7e
7 changed files with 125 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
.repl_history
build
tags
app/pixate_code.rb
resources/*.nib
resources/*.momd
resources/*.storyboardc
.DS_Store
nbproject
.redcar
#*#
*~
*.sw[po]
.eprj
.sass-cache
.idea
.dat*.*

View File

@@ -0,0 +1,4 @@
source 'https://rubygems.org'
gem 'rake'
# Add your dependencies here:

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios-extension'
begin
require 'bundler'
Bundler.require
rescue LoadError
end
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = '<%= name %>'
app.frameworks << "WatchKit"
app.info_plist['NSExtension'] = {
'NSExtensionPointIdentifier' => 'com.apple.watchkit'
}
app.info_plist['RemoteInterfacePrincipalClass'] = 'InterfaceController'
end

View File

@@ -0,0 +1,23 @@
class GlanceController < WKInterfaceController
def initWithContext(context)
super
# Initialize variables here.
# Configure interface objects here.
NSLog("%@ initWithContext", self)
return self;
end
def willActivate
# This method is called when watch view controller is about to be visible to user
NSLog("%@ will activate", self)
end
def didDeactivate
# This method is called when watch view controller is no longer visible
NSLog("%@ did deactivate", self)
end
end

View File

@@ -0,0 +1,23 @@
class InterfaceController < WKInterfaceController
def initWithContext(context)
super
# Initialize variables here.
# Configure interface objects here.
NSLog("%@ initWithContext", self)
return self
end
def willActivate
# This method is called when watch view controller is about to be visible to user
NSLog("%@ will activate", self)
end
def didDeactivate
# This method is called when watch view controller is no longer visible
NSLog("%@ did deactivate", self)
end
end

View File

@@ -0,0 +1,39 @@
class NotificationController < WKUserNotificationInterfaceController
def init
super
NSLog("%@ init", self)
return self;
end
def willActivate
# This method is called when watch view controller is about to be visible to user
NSLog("%@ will activate", self)
end
def didDeactivate
# This method is called when watch view controller is no longer visible
NSLog("%@ did deactivate", self)
end
def didReceiveLocalNotification(localNotification, withCompletion:completionHandler)
# This method is called when a local notification needs to be presented.
# Implement it if you use a dynamic notification interface.
# Populate your dynamic notification inteface as quickly as possible.
# After populating your dynamic notification interface call the completion block.
completionHandler(WKUserNotificationInterfaceTypeCustom)
end
def didReceiveRemoteNotification(remoteNotification, withCompletion:completionHandler)
# This method is called when a remote notification needs to be presented.
# Implement it if you use a dynamic notification interface.
# Populate your dynamic notification inteface as quickly as possible.
# After populating your dynamic notification interface call the completion block.
completionHandler(WKUserNotificationInterfaceTypeCustom)
end
end