{"id":1248,"url":"https://github.com/jensmeder/DarkLightning","last_synced_at":"2025-07-30T20:32:53.987Z","repository":{"id":56908201,"uuid":"44836270","full_name":"jensmeder/DarkLightning","owner":"jensmeder","description":"Simply the fastest way to transmit data between iOS/tvOS and OSX","archived":false,"fork":false,"pushed_at":"2020-10-19T18:55:52.000Z","size":1004,"stargazers_count":333,"open_issues_count":5,"forks_count":39,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-11-15T20:03:03.616Z","etag":null,"topics":["ios","macos","osx","tvos","usb","usbmuxd"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jensmeder.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-23T20:16:44.000Z","updated_at":"2024-07-25T18:44:20.000Z","dependencies_parsed_at":"2022-08-21T03:20:56.772Z","dependency_job_id":null,"html_url":"https://github.com/jensmeder/DarkLightning","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensmeder%2FDarkLightning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensmeder%2FDarkLightning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensmeder%2FDarkLightning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensmeder%2FDarkLightning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jensmeder","download_url":"https://codeload.github.com/jensmeder/DarkLightning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228187607,"owners_count":17882335,"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":["ios","macos","osx","tvos","usb","usbmuxd"],"created_at":"2024-01-05T20:15:42.166Z","updated_at":"2024-12-04T20:31:09.577Z","avatar_url":"https://github.com/jensmeder.png","language":"Swift","funding_links":[],"categories":["Hardware","Layout"],"sub_categories":["Other Hardware","Other free courses"],"readme":"[![Build Status](https://api.travis-ci.org/jensmeder/DarkLightning.svg?branch=master)](https://travis-ci.org/jensmeder/DarkLightning.svg?branch=master)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/DarkLightning.svg)](https://img.shields.io/cocoapods/v/DarkLightning.svg)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![codecov.io](https://codecov.io/github/jensmeder/DarkLightning/coverage.svg?branch=master)](https://codecov.io/github/jensmeder/DarkLightning?branch=master)\n[![codebeat badge](https://codebeat.co/badges/4698ebf5-c25e-428b-baa8-77de2a9e7380)](https://codebeat.co/projects/github-com-jensmeder-darklightning-master)\n\n# DarkLightning\n                      \nDarkLightning is a lightweight Swift library to allow data transmission between iOS/tvOS devices (Lightning port, Dock connector, USB-C) and OSX (USB) at 480MBit - without jailbreaking your iOS/tvOS device. It uses the usbmuxd service on OSX to open a TCP socket connection to the iOS/tvOS device. \n\n## Overview\n\n1. [Features](README.md#1-features)\n2. [System requirements](README.md#2-requirements)\n3. [Installation](README.md#3-installation)\n4. [Usage](README.md#4-usage)\n5. [Example](README.md#5-example)\n6. [License](README.md#6-license)\n\n## 1. Features\n\n* iOS/tvOS und OSX implementations to transmit data with up to 480 MBit via USB between iOS/tvOS and OSX\n* Simulator connection for debugging with iOS/tvOS Simulator\n* Information on connected iOS/tvOS devices on OSX\n* Callbacks for newly connected and disconnected iOS/tvOS devices on OSX\n\n## 2. Requirements\n\n* iOS 8.0+\n* tvOS 9.0+\n* Mac OS X 10.10+\n* Xcode 8.3\n\n## 3. Installation\n\nDarkLightning is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"DarkLightning\"\n```\nThere are three subspecs included: `iOS`, `tvOS` and `OSX`. CocoaPods automatically selects the correct subspec depending on the platform you are developing for. That means that `pod \"DarkLightning\"` and `pod \"DarkLightning/iOS\"` have the same effect if you are developing an iOS app.\n\n## 4. Usage\n\nThe basic procedure to open a connection between iOS/tvOS and OSX looks like this:\n\n1. Start a `DevicePort` on a port on iOS/tvOS\n2. Discover the device on OSX\n3. Establish a connection to the previously defined port on iOS/tvOS\n\nYou can send an arbitrary amount of bytes between iOS/tvOS and OSX. The data are being sent using [TCP](https://en.wikipedia.org/wiki/Transmission_Control_Protocol).\n\n### 4.1 iOS/tvOS\n\n#### 4.1.1 Initialization\n\n```swift\nlet port = DevicePort(delegate: MyPortDelegate())\nport.open()\n\n```\n#### 4.1.2 Receiving Data\n\n```swift\npublic func port(port: DarkLightning.Port, didReceiveData data: OOData) {\n\n}\n```\n\n#### 4.1.3 Sending Data\n\n```swift\nlet data = \"Hello World\".data(using: .utf8)\nport.writeData(data: data!)\n```\n\n### 4.2 OSX\n\n#### 4.2.1 Initialization\n\n```swift\nlet daemon = USBDaemon(delegate: MyDaemonDelegate(), deviceDelegate: MyDeviceDelegate())\ndaemon.start()\n```\n\n#### 4.2.2 Device Discovery\n\nAs soon as you plug in or out an iOS/tvOS device to your Mac you will receive a callback on the corresponding delegate method (`daemon(_:didAttach:)` or `daemon(_:didDetach:)`) of `USBDaemon`. You will also receive a callback on `daemon(_:didAttach:)` for every iOS/tvOS device that was already attached to OSX when you started the discovery via `daemon.start()`.\n\n```swift\n\n// Called for every device that already is or will be attached to the system\n\npublic func daemon(_ daemon: Daemon, didAttach device: Device) {\n     \n}\n\n// Called for every iOS/tvOS device that has been detached from the system\n\npublic func daemon(_ daemon: Daemon, didDetach device: Device) {\n        \n}\n```\n#### 4.2.3 Connections\n\nWith the help of a discovered `Device` you can now establish a connection to your iOS/tvOS app.\n\n```swift\ndevice.connect()\n```\nWhen you are done with the connection make sure to close it properly.\n\n```swift\ndevice.disconnect()\n```\n\n#### 4.2.4 Receiving Data\n\n```swift\npublic func device(_ device: Device, didReceiveData data: OOData) {\n\t\t\n}\n```\n\n#### 4.2.3 Sending Data\n\n```swift\nlet data = \"Hello World\".data(using: .utf8)\ndevice.writeData(data: data!)\n```\n\n## 5. Example\n\nThe Example (see _Example_ folder) is a simple messenger that uses DarkLightning to send text messages from iOS/tvOS to OSX and vice versa. \n\n_Note_: The iOS/tvOS application needs to be launched before the OSX part. The OSX part will try to connect to the first device that has been attached via USB. If there are no attached devices it tries to connect to the iOS/tvOS Simulator.\n\n## 6. License\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 Jens Meder\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjensmeder%2FDarkLightning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjensmeder%2FDarkLightning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjensmeder%2FDarkLightning/lists"}