
WatchKitのスライダーを試してみます。
[InterfaceController.swift]
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
@IBAction func slide(value: Float) {
WKInterfaceController.openParentApplication([“Slider” : value]) { (results, err) -> Void in
println(“\(results)”)
}
}
}
[AppDelegate.swift]
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, handleWatchKitExtensionRequest userInfo: [NSObject : AnyObject]?, reply: (([NSObject : AnyObject]!) -> Void)!) {
UIAlertView(title: “Slider”, message: “\(userInfo!)”, delegate: nil, cancelButtonTitle: “OK”).show()
reply([“response” : userInfo!])
}
}