The SwiftUI app bundles the Go swarm engine through gomobile, so an iPhone is a real peer using the existing PAKE handshake, chunk verification, and relay fallback. XcodeGen builds the project and devicectl installs it on the paired phone.
23 lines
724 B
Bash
Executable File
23 lines
724 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build the Go swarm engine as an iOS XCFramework. Run this before
|
|
# `xcodegen generate` whenever the Go bridge or anything under src/ changes.
|
|
set -euo pipefail
|
|
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
TOOLS="$HERE/.build/tools"
|
|
mkdir -p "$TOOLS"
|
|
|
|
cd "$HERE/GoBridge"
|
|
|
|
# Install the exact gomobile/gobind versions recorded in this module. The
|
|
# tools live in the app folder so they are easy to delete and never leak
|
|
# into the rest of the repo.
|
|
GOBIN="$TOOLS" go install golang.org/x/mobile/cmd/gomobile golang.org/x/mobile/cmd/gobind
|
|
export PATH="$TOOLS:$PATH"
|
|
|
|
gomobile init
|
|
rm -rf "$HERE/Share.xcframework"
|
|
gomobile bind -target=ios -o "$HERE/Share.xcframework" .
|
|
|
|
echo "Built $HERE/Share.xcframework"
|