{"id":16834586,"url":"https://github.com/reecereynolds/nativescript-watchos-connector","last_synced_at":"2025-11-07T10:30:31.708Z","repository":{"id":42931289,"uuid":"239570712","full_name":"ReeceReynolds/nativescript-watchos-connector","owner":"ReeceReynolds","description":"This is a NativeScript plugin that uses Apple WatchConnectivity to pass and receive data to a companion WatchOS app.","archived":true,"fork":false,"pushed_at":"2023-03-04T05:59:10.000Z","size":1292,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T13:36:50.330Z","etag":null,"topics":["apple-watch","ios","nativescript","nativescript-plugin","watchos"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ReeceReynolds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-10T17:26:53.000Z","updated_at":"2024-12-05T00:15:48.000Z","dependencies_parsed_at":"2024-11-13T11:40:53.948Z","dependency_job_id":"c1ba891b-ca6e-4c94-81e1-6f61f59681f4","html_url":"https://github.com/ReeceReynolds/nativescript-watchos-connector","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReeceReynolds%2Fnativescript-watchos-connector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReeceReynolds%2Fnativescript-watchos-connector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReeceReynolds%2Fnativescript-watchos-connector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReeceReynolds%2Fnativescript-watchos-connector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReeceReynolds","download_url":"https://codeload.github.com/ReeceReynolds/nativescript-watchos-connector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239526493,"owners_count":19653552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apple-watch","ios","nativescript","nativescript-plugin","watchos"],"created_at":"2024-10-13T12:07:01.778Z","updated_at":"2025-11-07T10:30:31.665Z","avatar_url":"https://github.com/ReeceReynolds.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n#  nativescript-watchos-connector\nThis is a NativeScript plugin that uses Apple WatchConnectivity to pass and receive data to a companion WatchOS app.\n\n[![](https://img.shields.io/npm/v/nativescript-watchos-connector?style=for-the-badge)](https://www.npmjs.com/package/nativescript-watchos-connector)  [![](https://img.shields.io/npm/dt/nativescript-watchos-connector?style=for-the-badge)](https://www.npmjs.com/package/nativescript-watchos-connector)  [![](https://img.shields.io/github/issues/reecereynolds/nativescript-watchos-connector?style=for-the-badge)](https://github.com/ReeceReynolds/nativescript-watchos-connector/issues)\n\n#  Prerequisites / Requirements\nBefore using this plugin, make sure you have followed the NativeScript blog post on [Developing a watchOS Extension For Your NativeScript App](https://www.nativescript.org/blog/developing-a-watchos-extension-for-your-nativescript-app) and [iOS WatchOS Applications](https://docs.nativescript.org/angular/tooling/ios-watch-apps).  \n\n#  Installation NativeScript 7\n```javascript\nnpm i nativescript-watchos-connector\n```\n\n#  Installation prior to NativeScript 7:\n```javascript\nnpm i nativescript-watchos-connector@1.0.11\n```\n\n#  Usage\n**NativeScript Angular**\n1. For this plugin to work you must first add the nativescript-watchos-connector as a provider in your `app.module.ts`:\n\n**TypeScript**\n```javascript\nimport  {  WatchOSConnector  }  from  'nativescript-watchos-connector'\n\n@NgModule({\n\tbootstrap: [AppComponent],\n\timports: [],\n\tproviders: [ WatchOSConnector ],\n\tdeclarations: [ AppComponent ],\n\tschemas: [ NO_ERRORS_SCHEMA ]\n})\n```\n\n2. Import the nativescript-watchos-connector plugin:\n\n**TypeScript**\n```javascript\nimport  {  WatchOSConnector  }  from  'nativescript-watchos-connector'\n```\n\n3. Create an instance of the import in the constructor:\n\n**TypeScript**\n```javascript\nconstructor(\n\tprivate _watchOSConnector: WatchOSConnector\n) {}\n```\n\n##  Plugin Overview\nThis is a list of all currently available functions and a brief description of their usage within this plugin.\n\n|Function | Description |\n|--|--|\n|`createWCSession()` |Creates a WCSession|\n|`watchOSChecker()`|Checks if the user is on iOS, has an Apple Watch paired and the WatchOS app is installed|\n|`checkActivation()`|Checks if the WCSession is active (if not, session will be activated)|\n|`convertInt(value)`|Return value as Obj-C int|\n|`convertDouble(value)`|Return value as Obj-C double|\n|`convertFloat(value)`|Return value as Obj-C float|\n|`sendObjectToWatch('objectKey', object)`|Send the data to the companion WatchOS App using ApplicationContext|\n\n##  createWCSession()\n`createWCSession` checks if the device can support a WCSession, if so a WCSession will be created.\n\n**TypeScript**\n```javascript\nthis.watchOSConnector.createWCSession()\n```\n\n##  watchOSChecker()\nUse `watchOSChecker` instead of `isIOS` when working with passing data to the Apple Watch. This checks if the user is on iOS, has an Apple Watch paired and the WatchOS app is installed (**returns boolean**)\n\n**TypeScript**\n```javascript\nif (this.watchOSConnector.watchOSChecker()) {\n// Only run if WatchOS app is avalaible\n}\n```\n\n##  checkActivation()\nChecks if the WCSession is active, if not this will activate the current session. This is called in `sendObject()` to ensure there is an active session.\n\n**TypeScript**\n```javascript\nthis.watchOSConnector.checkActivation()\n```\n\n##  convertInt(value)\nReturns the value as a NSNumber with int\n\n**TypeScript**\n```javascript\nthis.watchOSConnector.convertInt(2319)\n```\n\n##  convertDouble(value)\nReturns the value as a NSNumber with double\n\n**TypeScript**\n```javascript\nthis.watchOSConnector.convertDouble(42.957194)\n```\n\n##  convertFloat(value)\nReturns the value as a NSNumber with float\n\n**TypeScript**\n```javascript\nthis.watchOSConnector.convertFloat(882.152)\n```\n\n##  sendObjectToWatch(objectKey, object)\nSends the data to the companion WatchOS app using `updateApplicationContext`. You need to pass in a key for the object and an object of **Objective-C valid** values.\n\n**TypeScript**\n```javascript\nlet intValue =  this.watchOSConnector.convertInt(4)\nlet doubleValue =  this.watchOSConnector.convertDouble(45.1)\n\nlet numberObject =  {\n\tconvertedInt: intValue,\n\tconvertedDouble: doubleValue\n}\n\nthis.watchOSConnector.sendObject('numberObjectKey', numberObject)\n```\n\n##  v2.0.0 Release\n 1. Updated to be compatible with NativeScript 7\n\n##  Future Releases\n- [ ] Add images to README\n- [ ] Create a demo app\n\n##  Contributors\n - DanHef - [https://github.com/DanHef](https://github.com/DanHef)\n\n##  License\nApache License Version 2.0, January 2004","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freecereynolds%2Fnativescript-watchos-connector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freecereynolds%2Fnativescript-watchos-connector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freecereynolds%2Fnativescript-watchos-connector/lists"}