Add
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,83 @@
|
||||
# Hyperclip-iOS - P2P Clipboard Receiver Demo
|
||||
|
||||
## Overview
|
||||
iOS demo app embedding **Bare** JS runtime via **bare-kit**. Receives clipboard text P2P from **hyperclip-desktop**. Hypercore stores text blocks; Hyperswarm discovers/replicates. Direct sync, no servers.
|
||||
|
||||
**GitHub**: [holepunchto/hyperclip-ios](https://github.com/holepunchto/hyperclip-ios) (Apache-2.0)
|
||||
|
||||
**Status**: Example/demo. Sideload build (no App Store).
|
||||
|
||||
## Features
|
||||
- Live clipboard tail via Hypercore readstream
|
||||
- Auto-copy button to iOS clipboard
|
||||
- Simple UIKit UI (dark theme)
|
||||
- App lifecycle: suspend/resume Bare
|
||||
- arm64 iOS simulator/device
|
||||
|
||||
## Build & Run
|
||||
Req: Xcode, `npm i -g bare-dev`
|
||||
|
||||
```
|
||||
git clone https://github.com/holepunchto/hyperclip-ios
|
||||
cd hyperclip-ios
|
||||
git submodule update --init --recursive
|
||||
npm i
|
||||
# Get key from hyperclip-desktop/pear dev
|
||||
sed -i 's/HYPERCLIP_DESKTOP_KEY/YOUR_KEY/g' app/app.js
|
||||
bare-dev configure --debug --platform ios --arch arm64 --simulator
|
||||
bare-dev build --debug
|
||||
bare-dev ios run --attach
|
||||
```
|
||||
|
||||
## Architecture
|
||||
```
|
||||
UIKit App (ObjC)
|
||||
↓ BareWorklet (app.bundle)
|
||||
JS: app.js
|
||||
↓ Hyperswarm(core.discoveryKey) → Replicate
|
||||
↓ Hypercore(YOUR_KEY) → tail live blocks
|
||||
↓ BareRPC 'ping'+block → IPC
|
||||
Native: Update UILabel w/ text
|
||||
```
|
||||
|
||||
## Code Highlights
|
||||
**app/app.js** (~100 LOC):
|
||||
```js
|
||||
const swarm = new Hyperswarm()
|
||||
const core = new Hypercore('./tmp/hyperclip/', 'YOUR_KEY')
|
||||
swarm.join(core.discoveryKey)
|
||||
swarm.on('connection', conn => core.replicate(conn))
|
||||
for await (const block of core.createReadStream({live:true})) {
|
||||
rpc.request('ping').send(block) // Clipboard text
|
||||
}
|
||||
```
|
||||
|
||||
**app/AppDelegate.m**:
|
||||
- UI: Logo UIImageView, UILabel (dynamic), UIButton (copy - NOTE: hardcoded bug).
|
||||
- BareIPC/RPC: Handles 'ping', sets ipcData → label.text.
|
||||
- Colors: #1b1d29 bg.
|
||||
|
||||
**Deps** (`package.json`):
|
||||
- hypercore@^10.37.11
|
||||
- hyperswarm@^4.8.0
|
||||
- bare-fs@^2.3.1
|
||||
|
||||
## iOS Specifics
|
||||
- Embedded bundle: `app.bundle.h`
|
||||
- CMakeLists.txt: bare-kit integration.
|
||||
- No extra perms (network implicit).
|
||||
- Simulator: arm64; Xcode auto-opens.
|
||||
|
||||
## Issues/Notes
|
||||
- Copy button hardcoded (fix: use ipcData).
|
||||
- /tmp cleanup on start.
|
||||
- Nested submodules (bare-kit → bare/lib*).
|
||||
|
||||
## Interconnects
|
||||
- hypercore.md hyperswarm.md bare.md
|
||||
- Pairs: hyperclip-desktop (sender)
|
||||
- Ecosystem: Pear/Bare iOS embed example.
|
||||
|
||||
**Size**: Minimal demo.
|
||||
**Depth**: App-level (not lib).
|
||||
**Chars**: ~1.5k
|
||||
Reference in New Issue
Block a user