├── README.md ├── WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ └── Interface.storyboard └── Info.plist ├── WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension ├── Assets.xcassets │ └── README__ignoredByTemplate__ ├── ExtensionDelegate.swift ├── Info.plist └── InterfaceController.swift ├── WatchOS2-NewAPI-WatchConnectivity-Example.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── WladDicario.xcuserdatad │ └── xcschemes │ ├── WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App.xcscheme │ ├── WatchOS2-NewAPI-WatchConnectivity-Example.xcscheme │ └── xcschememanagement.plist ├── WatchOS2-NewAPI-WatchConnectivity-Example ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist └── ViewController.swift └── source └── Apple_Watch_template-WatchConnectivity.jpg /README.md: -------------------------------------------------------------------------------- 1 | ![](https://img.shields.io/badge/build-pass-brightgreen.svg?style=flat-square) 2 | ![](https://img.shields.io/badge/platform-WatchOS2-ff69b4.svg?style=flat-square) 3 | ![](https://img.shields.io/badge/Require-XCode%208-lightgrey.svg?style=flat-square) 4 | 5 | 6 | # WatchOS2 - New API - WatchConnectivity - Example 7 | WatchOS 2 Experiments - New API Components - WatchConnectivity with Paired Devices. 8 | 9 | ## Example 10 | 11 | ![](https://raw.githubusercontent.com/Sweefties/WatchOS2-NewAPI-WatchConnectivity-Example/master/source/Apple_Watch_template-WatchConnectivity.jpg) 12 | 13 | 14 | ## Requirements 15 | 16 | - >= XCode 8.0. 17 | - >= Swift 3. 18 | - >= iOS 9.0. 19 | 20 | Tested on WatchOS3, iOS 10.0 Simulators, Apple Watch, iPhone 6, iPhone 7. 21 | 22 | ## Important 23 | 24 | this is the Xcode 8 / Swift 3 updated project. 25 | 26 | ## Usage 27 | 28 | To run the example project, download or clone the repo. 29 | 30 | 31 | ### Example Code! 32 | 33 | 34 | Configure Watch App: 35 | 36 | - Drag and drop WKInterfaceButton, WKInterfaceLabel to Interface Controller (Storyboard) 37 | - connect your WKInterfaceButton to your Interface Controller class 38 | - define your WKInterfaceButton IBAction 39 | 40 | Configure iOS App: 41 | 42 | - Drag and drop UIButton, UILabel to ViewController (Storyboard) 43 | - connect your UIButton to your ViewController class 44 | - define your UIButton IBAction 45 | 46 | 47 | Example of code in controllers classes WKInterfaceController (for WatchOS) AND ViewController (for iOS App) : 48 | 49 | - Add WatchConnectivity Framework 50 | 51 | ```swift 52 | import WatchConnectivity 53 | ``` 54 | 55 | - Properties 56 | 57 | ```swift 58 | var session : WCSession! 59 | ``` 60 | 61 | - in willActivate() for Watch Extension AND viewDidLoad() for iOS App 62 | 63 | ```swift 64 | // To configure and activate the session 65 | if WCSession.isSupported() { 66 | session = WCSession.defaultSession() 67 | session.delegate = self 68 | session.activateSession() 69 | } 70 | ``` 71 | 72 | - Send message example (iOS App -> Watch) 73 | 74 | ```swift 75 | // Method to send message to watchOS 76 | @IBAction func sendToWatch(sender: AnyObject) { 77 | // A dictionary of property list values that you want to send. 78 | let messageToSend = ["Message":"Hi watch, are you here?"] 79 | 80 | // Task : Sends a message immediately to the counterpart and optionally delivers a response 81 | session.sendMessage(messageToSend, replyHandler: { (replyMessage) -> Void in 82 | 83 | // Reply handler - present the reply message on screen 84 | let value = replyMessage["Message"] as? String 85 | 86 | // GCD - Present on the screen 87 | dispatch_async(dispatch_get_main_queue(), { () -> Void in 88 | self.replyLabel.text = value! 89 | }) 90 | 91 | }) { (error:NSError) -> Void in 92 | // Catch any error Handler 93 | print("error: \(error.localizedDescription)") 94 | } 95 | } 96 | ``` 97 | 98 | - Send message example (Watch -> iOS App) 99 | 100 | ```swift 101 | // Send message to paired iOS App (Parent) 102 | @IBAction func sendToParent() { 103 | // A dictionary of property list values that you want to send. 104 | let messageToSend = ["Message":"Hey iPhone! I'm reachable!!!"] 105 | 106 | // Task : Sends a message immediately to the counterpart and optionally delivers a response 107 | session.sendMessage(messageToSend, replyHandler: { (replyMessage) -> Void in 108 | 109 | // Reply handler - present the reply message on screen 110 | let value = replyMessage["Message"] as? String 111 | 112 | // Set message label text with value 113 | self.messageLabel.setText(value) 114 | 115 | }) { (error:NSError) -> Void in 116 | // Catch any error Handler 117 | print("error: \(error.localizedDescription)") 118 | } 119 | } 120 | ``` 121 | 122 | - WCSession Protocol example 123 | 124 | ```swift 125 | // WCSession Delegate protocol 126 | func session(session: WCSession, didReceiveMessage message: [String : AnyObject], replyHandler: ([String : AnyObject]) -> Void) { 127 | 128 | // Reply handler, received message 129 | let value = message["Message"] as? String 130 | 131 | // GCD - Present on the screen 132 | dispatch_async(dispatch_get_main_queue()) { () -> Void in 133 | self.messageLabel.setText(value!) 134 | } 135 | 136 | // Send a reply 137 | replyHandler(["Message":"Yes!\niOS 9.0 + WatchOS2 ..AAAAAAmazing!"]) 138 | 139 | } 140 | ``` 141 | 142 | 143 | Build and Run WatchApp AND iOS App! 144 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "24x24", 5 | "idiom" : "watch", 6 | "scale" : "2x", 7 | "role" : "notificationCenter", 8 | "subtype" : "38mm" 9 | }, 10 | { 11 | "size" : "27.5x27.5", 12 | "idiom" : "watch", 13 | "scale" : "2x", 14 | "role" : "notificationCenter", 15 | "subtype" : "42mm" 16 | }, 17 | { 18 | "size" : "29x29", 19 | "idiom" : "watch", 20 | "role" : "companionSettings", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "size" : "29x29", 25 | "idiom" : "watch", 26 | "role" : "companionSettings", 27 | "scale" : "3x" 28 | }, 29 | { 30 | "size" : "40x40", 31 | "idiom" : "watch", 32 | "scale" : "2x", 33 | "role" : "appLauncher", 34 | "subtype" : "38mm" 35 | }, 36 | { 37 | "size" : "44x44", 38 | "idiom" : "watch", 39 | "scale" : "2x", 40 | "role" : "longLook", 41 | "subtype" : "42mm" 42 | }, 43 | { 44 | "size" : "86x86", 45 | "idiom" : "watch", 46 | "scale" : "2x", 47 | "role" : "quickLook", 48 | "subtype" : "38mm" 49 | }, 50 | { 51 | "size" : "98x98", 52 | "idiom" : "watch", 53 | "scale" : "2x", 54 | "role" : "quickLook", 55 | "subtype" : "42mm" 56 | } 57 | ], 58 | "info" : { 59 | "version" : 1, 60 | "author" : "xcode" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App/Base.lproj/Interface.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | UISupportedInterfaceOrientations 26 | 27 | UIInterfaceOrientationPortrait 28 | UIInterfaceOrientationPortraitUpsideDown 29 | 30 | WKCompanionAppBundleIdentifier 31 | com.sweefties.WatchOS2-NewAPI-WatchConnectivity-Example 32 | WKWatchKitApp 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension/Assets.xcassets/README__ignoredByTemplate__: -------------------------------------------------------------------------------- 1 | Did you know that git does not support storing empty directories? 2 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension/ExtensionDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExtensionDelegate.swift 3 | // WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension 4 | // 5 | // Created by Wlad Dicario on 07/09/2015. 6 | // Copyright © 2015 Sweefties. All rights reserved. 7 | // 8 | 9 | import WatchKit 10 | 11 | class ExtensionDelegate: NSObject, WKExtensionDelegate { 12 | 13 | func applicationDidFinishLaunching() { 14 | // Perform any final initialization of your application. 15 | } 16 | 17 | func applicationDidBecomeActive() { 18 | // 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. 19 | } 20 | 21 | func applicationWillResignActive() { 22 | // 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. 23 | // Use this method to pause ongoing tasks, disable timers, etc. 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSExtension 26 | 27 | NSExtensionAttributes 28 | 29 | WKAppBundleIdentifier 30 | com.sweefties.WatchOS2-NewAPI-WatchConnectivity-Example.watchkitapp 31 | 32 | NSExtensionPointIdentifier 33 | com.apple.watchkit 34 | 35 | RemoteInterfacePrincipalClass 36 | $(PRODUCT_MODULE_NAME).InterfaceController 37 | WKExtensionDelegateClassName 38 | $(PRODUCT_MODULE_NAME).ExtensionDelegate 39 | 40 | 41 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension/InterfaceController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InterfaceController.swift 3 | // WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension 4 | // 5 | // Created by Wlad Dicario on 07/09/2015. 6 | // Copyright © 2015 Sweefties. All rights reserved. 7 | // 8 | 9 | import WatchKit 10 | import Foundation 11 | import WatchConnectivity 12 | 13 | class InterfaceController: WKInterfaceController, WCSessionDelegate { 14 | 15 | 16 | /** Called when the session has completed activation. If session state is WCSessionActivationStateNotActivated there will be an error with more details. */ 17 | @available(watchOS 2.2, *) 18 | public func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { 19 | //..code 20 | } 21 | 22 | 23 | // MARK: - Interface 24 | @IBOutlet var messageLabel: WKInterfaceLabel! 25 | @IBOutlet var sendButton: WKInterfaceButton! 26 | 27 | // MARK: - Properties 28 | var session : WCSession! 29 | 30 | // MARK: - Context Initializer 31 | override func awake(withContext context: Any?) { 32 | super.awake(withContext: context) 33 | // Configure interface objects here. 34 | } 35 | 36 | // MARK: - Calls 37 | override func willActivate() { 38 | // This method is called when watch view controller is about to be visible to user 39 | super.willActivate() 40 | 41 | // To configure and activate the session 42 | if WCSession.isSupported() { 43 | session = WCSession.default() 44 | session.delegate = self 45 | session.activate() 46 | } 47 | } 48 | 49 | override func didDeactivate() { 50 | // This method is called when watch view controller is no longer visible 51 | super.didDeactivate() 52 | } 53 | 54 | } 55 | 56 | 57 | //MARK: - WatchActions -> InterfaceController 58 | typealias WatchActions = InterfaceController 59 | extension WatchActions { 60 | 61 | // Send message to paired iOS App (Parent) 62 | @IBAction func sendToParent() { 63 | sendMessage() 64 | } 65 | } 66 | 67 | 68 | //MARK: - WatchSessionProtocol -> InterfaceController 69 | typealias WatchSessionProtocol = InterfaceController 70 | extension WatchSessionProtocol { 71 | 72 | // WCSession Delegate protocol 73 | func session(_ session: WCSession, didReceiveMessage message: [String : Any], replyHandler: @escaping ([String : Any]) -> Void) { 74 | 75 | // Reply handler, received message 76 | let value = message["Message"] as? String 77 | 78 | // GCD - Present on the screen 79 | DispatchQueue.main.async { () -> Void in 80 | self.messageLabel.setText(value!) 81 | } 82 | 83 | // Send a reply 84 | replyHandler(["Message":"Yes!\niOS 9.0 + WatchOS2 ..AAAAAAmazing!"]) 85 | 86 | } 87 | } 88 | 89 | 90 | //MARK: - WatchSessionTasks -> InterfaceController 91 | typealias WatchSessionTasks = InterfaceController 92 | extension WatchSessionTasks { 93 | 94 | // Method to send message to paired iOS App (Parent) 95 | func sendMessage(){ 96 | // A dictionary of property list values that you want to send. 97 | let messageToSend = ["Message":"Hey iPhone! I'm reachable!!!"] 98 | 99 | // Task : Sends a message immediately to the counterpart and optionally delivers a response 100 | session.sendMessage(messageToSend, replyHandler: { (replyMessage) in 101 | 102 | // Reply handler - present the reply message on screen 103 | let value = replyMessage["Message"] as? String 104 | 105 | // Set message label text with value 106 | self.messageLabel.setText(value) 107 | 108 | }) { (error) in 109 | // Catch any error Handler 110 | print("error: \(error.localizedDescription)") 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7EF94F901B9E3012005ABF7A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EF94F8F1B9E3012005ABF7A /* AppDelegate.swift */; }; 11 | 7EF94F921B9E3012005ABF7A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EF94F911B9E3012005ABF7A /* ViewController.swift */; }; 12 | 7EF94F951B9E3012005ABF7A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7EF94F931B9E3012005ABF7A /* Main.storyboard */; }; 13 | 7EF94F971B9E3012005ABF7A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7EF94F961B9E3012005ABF7A /* Assets.xcassets */; }; 14 | 7EF94F9A1B9E3012005ABF7A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7EF94F981B9E3012005ABF7A /* LaunchScreen.storyboard */; }; 15 | 7EF94F9F1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 7EF94F9E1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App.app */; }; 16 | 7EF94FA51B9E3012005ABF7A /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7EF94FA31B9E3012005ABF7A /* Interface.storyboard */; }; 17 | 7EF94FA71B9E3012005ABF7A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7EF94FA61B9E3012005ABF7A /* Assets.xcassets */; }; 18 | 7EF94FAE1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 7EF94FAD1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 19 | 7EF94FB31B9E3012005ABF7A /* InterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EF94FB21B9E3012005ABF7A /* InterfaceController.swift */; }; 20 | 7EF94FB51B9E3012005ABF7A /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EF94FB41B9E3012005ABF7A /* ExtensionDelegate.swift */; }; 21 | 7EF94FB71B9E3012005ABF7A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7EF94FB61B9E3012005ABF7A /* Assets.xcassets */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | 7EF94FA01B9E3012005ABF7A /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = 7EF94F841B9E3012005ABF7A /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = 7EF94F9D1B9E3012005ABF7A; 30 | remoteInfo = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App"; 31 | }; 32 | 7EF94FAF1B9E3012005ABF7A /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 7EF94F841B9E3012005ABF7A /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 7EF94FAC1B9E3012005ABF7A; 37 | remoteInfo = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension"; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXCopyFilesBuildPhase section */ 42 | 7EF94FBE1B9E3012005ABF7A /* Embed App Extensions */ = { 43 | isa = PBXCopyFilesBuildPhase; 44 | buildActionMask = 2147483647; 45 | dstPath = ""; 46 | dstSubfolderSpec = 13; 47 | files = ( 48 | 7EF94FAE1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension.appex in Embed App Extensions */, 49 | ); 50 | name = "Embed App Extensions"; 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | 7EF94FC21B9E3012005ABF7A /* Embed Watch Content */ = { 54 | isa = PBXCopyFilesBuildPhase; 55 | buildActionMask = 2147483647; 56 | dstPath = "$(CONTENTS_FOLDER_PATH)/Watch"; 57 | dstSubfolderSpec = 16; 58 | files = ( 59 | 7EF94F9F1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App.app in Embed Watch Content */, 60 | ); 61 | name = "Embed Watch Content"; 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXCopyFilesBuildPhase section */ 65 | 66 | /* Begin PBXFileReference section */ 67 | 7EF94F8C1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "WatchOS2-NewAPI-WatchConnectivity-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 68 | 7EF94F8F1B9E3012005ABF7A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 69 | 7EF94F911B9E3012005ABF7A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 70 | 7EF94F941B9E3012005ABF7A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 71 | 7EF94F961B9E3012005ABF7A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 72 | 7EF94F991B9E3012005ABF7A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 73 | 7EF94F9B1B9E3012005ABF7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 74 | 7EF94F9E1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 75 | 7EF94FA41B9E3012005ABF7A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = ""; }; 76 | 7EF94FA61B9E3012005ABF7A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 77 | 7EF94FA81B9E3012005ABF7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 78 | 7EF94FAD1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 79 | 7EF94FB21B9E3012005ABF7A /* InterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceController.swift; sourceTree = ""; }; 80 | 7EF94FB41B9E3012005ABF7A /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = ""; }; 81 | 7EF94FB61B9E3012005ABF7A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 82 | 7EF94FB81B9E3012005ABF7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 83 | /* End PBXFileReference section */ 84 | 85 | /* Begin PBXFrameworksBuildPhase section */ 86 | 7EF94F891B9E3012005ABF7A /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | 7EF94FAA1B9E3012005ABF7A /* Frameworks */ = { 94 | isa = PBXFrameworksBuildPhase; 95 | buildActionMask = 2147483647; 96 | files = ( 97 | ); 98 | runOnlyForDeploymentPostprocessing = 0; 99 | }; 100 | /* End PBXFrameworksBuildPhase section */ 101 | 102 | /* Begin PBXGroup section */ 103 | 7EF94F831B9E3012005ABF7A = { 104 | isa = PBXGroup; 105 | children = ( 106 | 7EF94F8E1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example */, 107 | 7EF94FA21B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App */, 108 | 7EF94FB11B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension */, 109 | 7EF94F8D1B9E3012005ABF7A /* Products */, 110 | ); 111 | sourceTree = ""; 112 | }; 113 | 7EF94F8D1B9E3012005ABF7A /* Products */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 7EF94F8C1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example.app */, 117 | 7EF94F9E1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App.app */, 118 | 7EF94FAD1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension.appex */, 119 | ); 120 | name = Products; 121 | sourceTree = ""; 122 | }; 123 | 7EF94F8E1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 7EF94F8F1B9E3012005ABF7A /* AppDelegate.swift */, 127 | 7EF94F911B9E3012005ABF7A /* ViewController.swift */, 128 | 7EF94F931B9E3012005ABF7A /* Main.storyboard */, 129 | 7EF94F961B9E3012005ABF7A /* Assets.xcassets */, 130 | 7EF94F981B9E3012005ABF7A /* LaunchScreen.storyboard */, 131 | 7EF94F9B1B9E3012005ABF7A /* Info.plist */, 132 | ); 133 | path = "WatchOS2-NewAPI-WatchConnectivity-Example"; 134 | sourceTree = ""; 135 | }; 136 | 7EF94FA21B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 7EF94FA31B9E3012005ABF7A /* Interface.storyboard */, 140 | 7EF94FA61B9E3012005ABF7A /* Assets.xcassets */, 141 | 7EF94FA81B9E3012005ABF7A /* Info.plist */, 142 | ); 143 | path = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App"; 144 | sourceTree = ""; 145 | }; 146 | 7EF94FB11B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 7EF94FB21B9E3012005ABF7A /* InterfaceController.swift */, 150 | 7EF94FB41B9E3012005ABF7A /* ExtensionDelegate.swift */, 151 | 7EF94FB61B9E3012005ABF7A /* Assets.xcassets */, 152 | 7EF94FB81B9E3012005ABF7A /* Info.plist */, 153 | ); 154 | path = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension"; 155 | sourceTree = ""; 156 | }; 157 | /* End PBXGroup section */ 158 | 159 | /* Begin PBXNativeTarget section */ 160 | 7EF94F8B1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example */ = { 161 | isa = PBXNativeTarget; 162 | buildConfigurationList = 7EF94FC31B9E3012005ABF7A /* Build configuration list for PBXNativeTarget "WatchOS2-NewAPI-WatchConnectivity-Example" */; 163 | buildPhases = ( 164 | 7EF94F881B9E3012005ABF7A /* Sources */, 165 | 7EF94F891B9E3012005ABF7A /* Frameworks */, 166 | 7EF94F8A1B9E3012005ABF7A /* Resources */, 167 | 7EF94FC21B9E3012005ABF7A /* Embed Watch Content */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | 7EF94FA11B9E3012005ABF7A /* PBXTargetDependency */, 173 | ); 174 | name = "WatchOS2-NewAPI-WatchConnectivity-Example"; 175 | productName = "WatchOS2-NewAPI-WatchConnectivity-Example"; 176 | productReference = 7EF94F8C1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example.app */; 177 | productType = "com.apple.product-type.application"; 178 | }; 179 | 7EF94F9D1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = 7EF94FBF1B9E3012005ABF7A /* Build configuration list for PBXNativeTarget "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App" */; 182 | buildPhases = ( 183 | 7EF94F9C1B9E3012005ABF7A /* Resources */, 184 | 7EF94FBE1B9E3012005ABF7A /* Embed App Extensions */, 185 | ); 186 | buildRules = ( 187 | ); 188 | dependencies = ( 189 | 7EF94FB01B9E3012005ABF7A /* PBXTargetDependency */, 190 | ); 191 | name = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App"; 192 | productName = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App"; 193 | productReference = 7EF94F9E1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App.app */; 194 | productType = "com.apple.product-type.application.watchapp2"; 195 | }; 196 | 7EF94FAC1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension */ = { 197 | isa = PBXNativeTarget; 198 | buildConfigurationList = 7EF94FBB1B9E3012005ABF7A /* Build configuration list for PBXNativeTarget "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension" */; 199 | buildPhases = ( 200 | 7EF94FA91B9E3012005ABF7A /* Sources */, 201 | 7EF94FAA1B9E3012005ABF7A /* Frameworks */, 202 | 7EF94FAB1B9E3012005ABF7A /* Resources */, 203 | ); 204 | buildRules = ( 205 | ); 206 | dependencies = ( 207 | ); 208 | name = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension"; 209 | productName = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension"; 210 | productReference = 7EF94FAD1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension.appex */; 211 | productType = "com.apple.product-type.watchkit2-extension"; 212 | }; 213 | /* End PBXNativeTarget section */ 214 | 215 | /* Begin PBXProject section */ 216 | 7EF94F841B9E3012005ABF7A /* Project object */ = { 217 | isa = PBXProject; 218 | attributes = { 219 | LastUpgradeCheck = 0800; 220 | ORGANIZATIONNAME = Sweefties; 221 | TargetAttributes = { 222 | 7EF94F8B1B9E3012005ABF7A = { 223 | CreatedOnToolsVersion = 7.0; 224 | LastSwiftMigration = 0800; 225 | }; 226 | 7EF94F9D1B9E3012005ABF7A = { 227 | CreatedOnToolsVersion = 7.0; 228 | LastSwiftMigration = 0800; 229 | }; 230 | 7EF94FAC1B9E3012005ABF7A = { 231 | CreatedOnToolsVersion = 7.0; 232 | LastSwiftMigration = 0800; 233 | }; 234 | }; 235 | }; 236 | buildConfigurationList = 7EF94F871B9E3012005ABF7A /* Build configuration list for PBXProject "WatchOS2-NewAPI-WatchConnectivity-Example" */; 237 | compatibilityVersion = "Xcode 3.2"; 238 | developmentRegion = English; 239 | hasScannedForEncodings = 0; 240 | knownRegions = ( 241 | en, 242 | Base, 243 | ); 244 | mainGroup = 7EF94F831B9E3012005ABF7A; 245 | productRefGroup = 7EF94F8D1B9E3012005ABF7A /* Products */; 246 | projectDirPath = ""; 247 | projectRoot = ""; 248 | targets = ( 249 | 7EF94F8B1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example */, 250 | 7EF94F9D1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App */, 251 | 7EF94FAC1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension */, 252 | ); 253 | }; 254 | /* End PBXProject section */ 255 | 256 | /* Begin PBXResourcesBuildPhase section */ 257 | 7EF94F8A1B9E3012005ABF7A /* Resources */ = { 258 | isa = PBXResourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | 7EF94F9A1B9E3012005ABF7A /* LaunchScreen.storyboard in Resources */, 262 | 7EF94F971B9E3012005ABF7A /* Assets.xcassets in Resources */, 263 | 7EF94F951B9E3012005ABF7A /* Main.storyboard in Resources */, 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | 7EF94F9C1B9E3012005ABF7A /* Resources */ = { 268 | isa = PBXResourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | 7EF94FA71B9E3012005ABF7A /* Assets.xcassets in Resources */, 272 | 7EF94FA51B9E3012005ABF7A /* Interface.storyboard in Resources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | 7EF94FAB1B9E3012005ABF7A /* Resources */ = { 277 | isa = PBXResourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | 7EF94FB71B9E3012005ABF7A /* Assets.xcassets in Resources */, 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXResourcesBuildPhase section */ 285 | 286 | /* Begin PBXSourcesBuildPhase section */ 287 | 7EF94F881B9E3012005ABF7A /* Sources */ = { 288 | isa = PBXSourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | 7EF94F921B9E3012005ABF7A /* ViewController.swift in Sources */, 292 | 7EF94F901B9E3012005ABF7A /* AppDelegate.swift in Sources */, 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | }; 296 | 7EF94FA91B9E3012005ABF7A /* Sources */ = { 297 | isa = PBXSourcesBuildPhase; 298 | buildActionMask = 2147483647; 299 | files = ( 300 | 7EF94FB51B9E3012005ABF7A /* ExtensionDelegate.swift in Sources */, 301 | 7EF94FB31B9E3012005ABF7A /* InterfaceController.swift in Sources */, 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | /* End PBXSourcesBuildPhase section */ 306 | 307 | /* Begin PBXTargetDependency section */ 308 | 7EF94FA11B9E3012005ABF7A /* PBXTargetDependency */ = { 309 | isa = PBXTargetDependency; 310 | target = 7EF94F9D1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App */; 311 | targetProxy = 7EF94FA01B9E3012005ABF7A /* PBXContainerItemProxy */; 312 | }; 313 | 7EF94FB01B9E3012005ABF7A /* PBXTargetDependency */ = { 314 | isa = PBXTargetDependency; 315 | target = 7EF94FAC1B9E3012005ABF7A /* WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension */; 316 | targetProxy = 7EF94FAF1B9E3012005ABF7A /* PBXContainerItemProxy */; 317 | }; 318 | /* End PBXTargetDependency section */ 319 | 320 | /* Begin PBXVariantGroup section */ 321 | 7EF94F931B9E3012005ABF7A /* Main.storyboard */ = { 322 | isa = PBXVariantGroup; 323 | children = ( 324 | 7EF94F941B9E3012005ABF7A /* Base */, 325 | ); 326 | name = Main.storyboard; 327 | sourceTree = ""; 328 | }; 329 | 7EF94F981B9E3012005ABF7A /* LaunchScreen.storyboard */ = { 330 | isa = PBXVariantGroup; 331 | children = ( 332 | 7EF94F991B9E3012005ABF7A /* Base */, 333 | ); 334 | name = LaunchScreen.storyboard; 335 | sourceTree = ""; 336 | }; 337 | 7EF94FA31B9E3012005ABF7A /* Interface.storyboard */ = { 338 | isa = PBXVariantGroup; 339 | children = ( 340 | 7EF94FA41B9E3012005ABF7A /* Base */, 341 | ); 342 | name = Interface.storyboard; 343 | sourceTree = ""; 344 | }; 345 | /* End PBXVariantGroup section */ 346 | 347 | /* Begin XCBuildConfiguration section */ 348 | 7EF94FB91B9E3012005ABF7A /* Debug */ = { 349 | isa = XCBuildConfiguration; 350 | buildSettings = { 351 | ALWAYS_SEARCH_USER_PATHS = NO; 352 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 353 | CLANG_CXX_LIBRARY = "libc++"; 354 | CLANG_ENABLE_MODULES = YES; 355 | CLANG_ENABLE_OBJC_ARC = YES; 356 | CLANG_WARN_BOOL_CONVERSION = YES; 357 | CLANG_WARN_CONSTANT_CONVERSION = YES; 358 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 359 | CLANG_WARN_EMPTY_BODY = YES; 360 | CLANG_WARN_ENUM_CONVERSION = YES; 361 | CLANG_WARN_INFINITE_RECURSION = YES; 362 | CLANG_WARN_INT_CONVERSION = YES; 363 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 364 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 365 | CLANG_WARN_UNREACHABLE_CODE = YES; 366 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 367 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 368 | COPY_PHASE_STRIP = NO; 369 | DEBUG_INFORMATION_FORMAT = dwarf; 370 | ENABLE_STRICT_OBJC_MSGSEND = YES; 371 | ENABLE_TESTABILITY = YES; 372 | GCC_C_LANGUAGE_STANDARD = gnu99; 373 | GCC_DYNAMIC_NO_PIC = NO; 374 | GCC_NO_COMMON_BLOCKS = YES; 375 | GCC_OPTIMIZATION_LEVEL = 0; 376 | GCC_PREPROCESSOR_DEFINITIONS = ( 377 | "DEBUG=1", 378 | "$(inherited)", 379 | ); 380 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 381 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 382 | GCC_WARN_UNDECLARED_SELECTOR = YES; 383 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 384 | GCC_WARN_UNUSED_FUNCTION = YES; 385 | GCC_WARN_UNUSED_VARIABLE = YES; 386 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 387 | MTL_ENABLE_DEBUG_INFO = YES; 388 | ONLY_ACTIVE_ARCH = YES; 389 | SDKROOT = iphoneos; 390 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 391 | TARGETED_DEVICE_FAMILY = "1,2"; 392 | }; 393 | name = Debug; 394 | }; 395 | 7EF94FBA1B9E3012005ABF7A /* Release */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | ALWAYS_SEARCH_USER_PATHS = NO; 399 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 400 | CLANG_CXX_LIBRARY = "libc++"; 401 | CLANG_ENABLE_MODULES = YES; 402 | CLANG_ENABLE_OBJC_ARC = YES; 403 | CLANG_WARN_BOOL_CONVERSION = YES; 404 | CLANG_WARN_CONSTANT_CONVERSION = YES; 405 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 406 | CLANG_WARN_EMPTY_BODY = YES; 407 | CLANG_WARN_ENUM_CONVERSION = YES; 408 | CLANG_WARN_INFINITE_RECURSION = YES; 409 | CLANG_WARN_INT_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 412 | CLANG_WARN_UNREACHABLE_CODE = YES; 413 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 414 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 415 | COPY_PHASE_STRIP = NO; 416 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 417 | ENABLE_NS_ASSERTIONS = NO; 418 | ENABLE_STRICT_OBJC_MSGSEND = YES; 419 | GCC_C_LANGUAGE_STANDARD = gnu99; 420 | GCC_NO_COMMON_BLOCKS = YES; 421 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 422 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 423 | GCC_WARN_UNDECLARED_SELECTOR = YES; 424 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 425 | GCC_WARN_UNUSED_FUNCTION = YES; 426 | GCC_WARN_UNUSED_VARIABLE = YES; 427 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 428 | MTL_ENABLE_DEBUG_INFO = NO; 429 | SDKROOT = iphoneos; 430 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 431 | TARGETED_DEVICE_FAMILY = "1,2"; 432 | VALIDATE_PRODUCT = YES; 433 | }; 434 | name = Release; 435 | }; 436 | 7EF94FBC1B9E3012005ABF7A /* Debug */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | INFOPLIST_FILE = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension/Info.plist"; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; 441 | PRODUCT_BUNDLE_IDENTIFIER = "com.sweefties.WatchOS2-NewAPI-WatchConnectivity-Example.watchkitapp.watchkitextension"; 442 | PRODUCT_NAME = "${TARGET_NAME}"; 443 | SDKROOT = watchos; 444 | SKIP_INSTALL = YES; 445 | SWIFT_VERSION = 3.0; 446 | TARGETED_DEVICE_FAMILY = 4; 447 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 448 | }; 449 | name = Debug; 450 | }; 451 | 7EF94FBD1B9E3012005ABF7A /* Release */ = { 452 | isa = XCBuildConfiguration; 453 | buildSettings = { 454 | INFOPLIST_FILE = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension/Info.plist"; 455 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; 456 | PRODUCT_BUNDLE_IDENTIFIER = "com.sweefties.WatchOS2-NewAPI-WatchConnectivity-Example.watchkitapp.watchkitextension"; 457 | PRODUCT_NAME = "${TARGET_NAME}"; 458 | SDKROOT = watchos; 459 | SKIP_INSTALL = YES; 460 | SWIFT_VERSION = 3.0; 461 | TARGETED_DEVICE_FAMILY = 4; 462 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 463 | }; 464 | name = Release; 465 | }; 466 | 7EF94FC01B9E3012005ABF7A /* Debug */ = { 467 | isa = XCBuildConfiguration; 468 | buildSettings = { 469 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | IBSC_MODULE = WatchOS2_NewAPI_WatchConnectivity_Example_WatchKit_Extension; 472 | INFOPLIST_FILE = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App/Info.plist"; 473 | PRODUCT_BUNDLE_IDENTIFIER = "com.sweefties.WatchOS2-NewAPI-WatchConnectivity-Example.watchkitapp"; 474 | PRODUCT_NAME = "$(TARGET_NAME)"; 475 | SDKROOT = watchos; 476 | SKIP_INSTALL = YES; 477 | SWIFT_VERSION = 3.0; 478 | TARGETED_DEVICE_FAMILY = 4; 479 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 480 | }; 481 | name = Debug; 482 | }; 483 | 7EF94FC11B9E3012005ABF7A /* Release */ = { 484 | isa = XCBuildConfiguration; 485 | buildSettings = { 486 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 487 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 488 | IBSC_MODULE = WatchOS2_NewAPI_WatchConnectivity_Example_WatchKit_Extension; 489 | INFOPLIST_FILE = "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App/Info.plist"; 490 | PRODUCT_BUNDLE_IDENTIFIER = "com.sweefties.WatchOS2-NewAPI-WatchConnectivity-Example.watchkitapp"; 491 | PRODUCT_NAME = "$(TARGET_NAME)"; 492 | SDKROOT = watchos; 493 | SKIP_INSTALL = YES; 494 | SWIFT_VERSION = 3.0; 495 | TARGETED_DEVICE_FAMILY = 4; 496 | WATCHOS_DEPLOYMENT_TARGET = 2.0; 497 | }; 498 | name = Release; 499 | }; 500 | 7EF94FC41B9E3012005ABF7A /* Debug */ = { 501 | isa = XCBuildConfiguration; 502 | buildSettings = { 503 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 504 | INFOPLIST_FILE = "WatchOS2-NewAPI-WatchConnectivity-Example/Info.plist"; 505 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 506 | PRODUCT_BUNDLE_IDENTIFIER = "com.sweefties.WatchOS2-NewAPI-WatchConnectivity-Example"; 507 | PRODUCT_NAME = "$(TARGET_NAME)"; 508 | SWIFT_VERSION = 3.0; 509 | }; 510 | name = Debug; 511 | }; 512 | 7EF94FC51B9E3012005ABF7A /* Release */ = { 513 | isa = XCBuildConfiguration; 514 | buildSettings = { 515 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 516 | INFOPLIST_FILE = "WatchOS2-NewAPI-WatchConnectivity-Example/Info.plist"; 517 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 518 | PRODUCT_BUNDLE_IDENTIFIER = "com.sweefties.WatchOS2-NewAPI-WatchConnectivity-Example"; 519 | PRODUCT_NAME = "$(TARGET_NAME)"; 520 | SWIFT_VERSION = 3.0; 521 | }; 522 | name = Release; 523 | }; 524 | /* End XCBuildConfiguration section */ 525 | 526 | /* Begin XCConfigurationList section */ 527 | 7EF94F871B9E3012005ABF7A /* Build configuration list for PBXProject "WatchOS2-NewAPI-WatchConnectivity-Example" */ = { 528 | isa = XCConfigurationList; 529 | buildConfigurations = ( 530 | 7EF94FB91B9E3012005ABF7A /* Debug */, 531 | 7EF94FBA1B9E3012005ABF7A /* Release */, 532 | ); 533 | defaultConfigurationIsVisible = 0; 534 | defaultConfigurationName = Release; 535 | }; 536 | 7EF94FBB1B9E3012005ABF7A /* Build configuration list for PBXNativeTarget "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit Extension" */ = { 537 | isa = XCConfigurationList; 538 | buildConfigurations = ( 539 | 7EF94FBC1B9E3012005ABF7A /* Debug */, 540 | 7EF94FBD1B9E3012005ABF7A /* Release */, 541 | ); 542 | defaultConfigurationIsVisible = 0; 543 | defaultConfigurationName = Release; 544 | }; 545 | 7EF94FBF1B9E3012005ABF7A /* Build configuration list for PBXNativeTarget "WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App" */ = { 546 | isa = XCConfigurationList; 547 | buildConfigurations = ( 548 | 7EF94FC01B9E3012005ABF7A /* Debug */, 549 | 7EF94FC11B9E3012005ABF7A /* Release */, 550 | ); 551 | defaultConfigurationIsVisible = 0; 552 | defaultConfigurationName = Release; 553 | }; 554 | 7EF94FC31B9E3012005ABF7A /* Build configuration list for PBXNativeTarget "WatchOS2-NewAPI-WatchConnectivity-Example" */ = { 555 | isa = XCConfigurationList; 556 | buildConfigurations = ( 557 | 7EF94FC41B9E3012005ABF7A /* Debug */, 558 | 7EF94FC51B9E3012005ABF7A /* Release */, 559 | ); 560 | defaultConfigurationIsVisible = 0; 561 | defaultConfigurationName = Release; 562 | }; 563 | /* End XCConfigurationList section */ 564 | }; 565 | rootObject = 7EF94F841B9E3012005ABF7A /* Project object */; 566 | } 567 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example.xcodeproj/xcuserdata/WladDicario.xcuserdatad/xcschemes/WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 60 | 61 | 67 | 68 | 69 | 70 | 71 | 72 | 82 | 86 | 92 | 93 | 94 | 95 | 101 | 102 | 103 | 104 | 105 | 106 | 112 | 116 | 122 | 123 | 124 | 125 | 131 | 132 | 133 | 134 | 136 | 137 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example.xcodeproj/xcuserdata/WladDicario.xcuserdatad/xcschemes/WatchOS2-NewAPI-WatchConnectivity-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example.xcodeproj/xcuserdata/WladDicario.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | WatchOS2-NewAPI-WatchConnectivity-Example WatchKit App.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | WatchOS2-NewAPI-WatchConnectivity-Example.xcscheme 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 7EF94F8B1B9E3012005ABF7A 21 | 22 | primary 23 | 24 | 25 | 7EF94F9D1B9E3012005ABF7A 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // WatchOS2-NewAPI-WatchConnectivity-Example 4 | // 5 | // Created by Wlad Dicario on 07/09/2015. 6 | // Copyright © 2015 Sweefties. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /WatchOS2-NewAPI-WatchConnectivity-Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // WatchOS2-NewAPI-WatchConnectivity-Example 4 | // 5 | // Created by Wlad Dicario on 07/09/2015. 6 | // Copyright © 2015 Sweefties. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import WatchConnectivity 11 | 12 | class ViewController: UIViewController, WCSessionDelegate { 13 | 14 | /** Called when all delegate callbacks for the previously selected watch has occurred. The session can be re-activated for the now selected watch using activateSession. */ 15 | @available(iOS 9.3, *) 16 | public func sessionDidDeactivate(_ session: WCSession) { 17 | //.. 18 | } 19 | 20 | 21 | /** Called when the session can no longer be used to modify or add any new transfers and, all interactive messages will be cancelled, but delegate callbacks for background transfers can still occur. This will happen when the selected watch is being changed. */ 22 | @available(iOS 9.3, *) 23 | public func sessionDidBecomeInactive(_ session: WCSession) { 24 | //.. 25 | } 26 | 27 | 28 | /** Called when the session has completed activation. If session state is WCSessionActivationStateNotActivated there will be an error with more details. */ 29 | @available(iOS 9.3, *) 30 | public func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { 31 | //.. 32 | } 33 | 34 | 35 | // MARK: - Interface 36 | @IBOutlet weak var sendButton: UIButton! 37 | @IBOutlet weak var replyLabel: UILabel! 38 | 39 | // MARK: - Properties 40 | fileprivate var session: WCSession! 41 | 42 | // MARK: - Calls 43 | override func viewDidLoad() { 44 | super.viewDidLoad() 45 | // Do any additional setup after loading the view, typically from a nib. 46 | 47 | // To configure and activate the session 48 | if WCSession.isSupported() { 49 | session = WCSession.default() 50 | session.delegate = self 51 | session.activate() 52 | } 53 | } 54 | 55 | // MARK: - Memory 56 | override func didReceiveMemoryWarning() { 57 | super.didReceiveMemoryWarning() 58 | // Dispose of any resources that can be recreated. 59 | } 60 | 61 | } 62 | 63 | 64 | //MARK: - PairedActions -> ViewController 65 | typealias PairedActions = ViewController 66 | extension PairedActions { 67 | 68 | // Send message to Apple Watch 69 | @IBAction func sendToWatch(_ sender: AnyObject) { 70 | sendMessage() 71 | } 72 | } 73 | 74 | 75 | //MARK: - WatchSessionProtocol -> ViewController 76 | typealias WatchSessionProtocol = ViewController 77 | extension WatchSessionProtocol { 78 | 79 | // WCSession Delegate protocol 80 | func session(_ session: WCSession, didReceiveMessage message: [String : Any], replyHandler: @escaping ([String : Any]) -> Void) { 81 | 82 | // Reply handler, received message 83 | let value = message["Message"] as? String 84 | 85 | // GCD - Present on the screen 86 | DispatchQueue.main.async { () -> Void in 87 | self.replyLabel.text = value! 88 | } 89 | 90 | // Send a reply 91 | replyHandler(["Message":"Hey Watch! Nice to meet you!\nWould you like work with me?"]) 92 | } 93 | } 94 | 95 | 96 | //MARK: - WatchSessionTasks -> ViewController 97 | typealias WatchSessionTasks = ViewController 98 | extension WatchSessionTasks { 99 | 100 | // Method to send message to watchOS 101 | func sendMessage(){ 102 | // A dictionary of property list values that you want to send. 103 | let messageToSend = ["Message":"Hi watch, are you here?"] 104 | 105 | // Task : Sends a message immediately to the counterpart and optionally delivers a response 106 | session.sendMessage(messageToSend, replyHandler: { (replyMessage) in 107 | // Reply handler - present the reply message on screen 108 | let value = replyMessage["Message"] as? String 109 | 110 | // GCD - Present on the screen 111 | DispatchQueue.main.async(execute: { () -> Void in 112 | self.replyLabel.text = value! 113 | }) 114 | 115 | }) { (error) in 116 | // Catch any error Handler 117 | print("error: \(error.localizedDescription)") 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /source/Apple_Watch_template-WatchConnectivity.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sweefties/WatchOS2-NewAPI-WatchConnectivity-Example/703884e95dd539da88410d8c6b0351f0bad202f0/source/Apple_Watch_template-WatchConnectivity.jpg --------------------------------------------------------------------------------