An iOS app for posting to a Backdrop CMS site running the
Moby (moby) module. It follows
SPECIFICATIONS.md, so it works the same as the
Android app.
It's built on Ubuntu with xtool, which builds, signs and installs iOS apps without a Mac.
Sources/MobyCore: the API client, models, and the rules that must match Android exactly (hashtags, HTML descriptions, dates, site addresses, media checks, video compression maths). Foundation only.Sources/Moby: the SwiftUI app.App/: the app's state (AppModel), Keychain tokens, the URLSession transport, and navigation.Screens/: Sites, Log in, Feed, Post page, Editor, Settings.
Tests/MobyCoreTests: the same cases as the Android unit tests.tools/: UI automation through WebDriverAgent (wda.sh,ui.py).
MOBY_CORE_ONLY=1 swift test # MobyCore's tests, on Linux
xtool dev build # build the app
./run.sh # build, install, launch and screenshot (phone unlocked)
MOBY_CORE_ONLY leaves the iOS app out of the package, since it can't build on
Linux without xtool's iOS SDK.
xtool registers the app as XTL-69A6DE71.org.mobyapp.ios. run.sh adds the
prefix itself.
Sources/MobyCore/ApiVersion.swift holds the API version the app is built
for, which it sends as ?api= on every request, and the list of changes it
uses. See "Versioning" in
SPECIFICATIONS.md.
After changing it, do a clean build (rm -rf .build, then ./run.sh).
Incremental xtool builds kept the old values compiled into the app.
Reaching a local DDEV site. The phone can't use *.ddev.site, which
resolves to the phone itself, and there's no USB port forwarding for iPhones.
Instead, it reaches the site over Wi-Fi at this computer's address, with
nothing outside the local network involved:
- Add the address as a DDEV hostname, in a separate file in the site's
.ddevfolder (delete it and restart DDEV when done):# .ddev/config.moby-ios.yaml additional_fqdns: - 192.168.1.189 - Run
tools/lan-proxy.py 192.168.1.189 8080, which forwards that port to DDEV until stopped. - In the app, add the site as
http://192.168.1.189:8080. iOS asks once to allow access to the local network.
Driving the UI. On iOS 27 and later, tools/hid.sh taps, drags and types
directly, without WebDriverAgent. Coordinates are in points, taken from
tools/hid.sh shot FILE screenshots:
tools/hid.sh tap 196 460
tools/hid.sh type "http://192.168.1.189:8080"
tools/hid.sh shot /tmp/screen.png
Its key command fails for Enter and Backspace, so tap on-screen buttons and
keys instead.
hid.sh taps need UI Automation. Settings → Developer → Enable UI
Automation must be on, which asks for the phone's passcode. With it off, taps
are silently ignored, while screenshots still work. Take coordinates from a
fresh, uncropped hid.sh shot, since layouts move when screens change.
On older iOS versions, or to tap elements by name, use WebDriverAgent (tools/wda.sh start, tools/ui.py,
then tools/wda.sh stop), and turn off Settings → Developer → Enable UI
Automation when done.
Publishing a release on GitHub runs .github/workflows/release.yml on a
macOS runner. App Store builds need Xcode, so it doesn't use xtool:
- It runs the MobyCore tests.
release/prepare.pywrites the release build's inputs torelease/build/:Info.plist, without the plain-HTTP exceptions for local sites;- the app icon as an asset catalog;
- the version and signing settings.
- XcodeGen turns
release/project.ymlinto an Xcode project. - It archives the app and exports a signed
.ipa, attached to the release asmoby-ios-{version}.ipa. - It uploads the build to App Store Connect for TestFlight and App Review. The run's summary says what to do next.
Running the workflow by hand (Actions → Release → Run workflow) builds an unsigned copy, which checks the app compiles with Xcode without any secrets.
- Tag: like Android, it must look like
v1.2.3. The build number is major × 1,000,000 + minor × 1,000 + patch. - Privacy manifest:
release/PrivacyInfo.xcprivacydeclares the "required reason" APIs the app uses. Update it when the app starts using another, such as file timestamps. - Signing: an Apple Distribution certificate and an App Store provisioning profile, both renewed yearly. The secrets are listed at the top of the workflow, and the steps to make them are below.
These run on Linux, with no Mac needed.
-
Make a key and certificate request, and keep the key safe:
openssl genrsa -out moby-distribution.key 2048 openssl req -new -key moby-distribution.key -out moby-distribution.csr -subj "/CN=Moby Distribution/C=US" -
Get the certificate. In Certificates, add an Apple Distribution certificate with the
.csr, and downloaddistribution.cer. -
Make the
.p12the workflow imports.-legacykeeps it readable by macOS'ssecuritytool. It asks for a password.openssl x509 -inform DER -in distribution.cer -out distribution.pem openssl pkcs12 -export -legacy -inkey moby-distribution.key -in distribution.pem -out distribution.p12 -
Register the App ID. In Identifiers, add an explicit App ID for
org.mobyapp.ios. xtool's development builds use their ownXTL-…IDs, so this is separate. -
Make the profile. In Profiles, add an App Store Connect profile for
org.mobyapp.ioswith the certificate, and download it. -
Create the app record. In App Store Connect, add a new iOS app with the bundle ID
org.mobyapp.ios. Uploads fail without it. -
Get an API key. In App Store Connect → Users and Access → Integrations, make a team key with the App Manager role, and download its
.p8file, which you can only download once. Note its key ID and the issuer ID. -
Add the secrets to the repository:
Secret Value IOS_DISTRIBUTION_CERT_P12_BASE64base64 -w0 distribution.p12IOS_DISTRIBUTION_CERT_PASSWORDThe .p12passwordIOS_PROVISIONING_PROFILE_BASE64base64 -w0 Moby_App_Store.mobileprovisionAPP_STORE_CONNECT_KEY_IDThe API key's ID APP_STORE_CONNECT_ISSUER_IDThe issuer ID APP_STORE_CONNECT_KEY_BASE64base64 -w0 AuthKey_XXXXXXXXXX.p8
Keep the key, .p12 and .p8 out of the repository; .gitignore covers
them. When the certificate expires, repeat steps 1–3 and 5, and update the
first three secrets.
Tested on an iPhone 15 Plus with iOS 27.2.1 (adding a site, the feed, posting with tags and location, editing, deleting, settings). Photos and videos were not tested on the device.
- Sites: list, favicons with a letter fallback, login status, settings, log out and remove (with their confirmations), name and favicon refresh.
- Log in: address normalization, setup issues, the form built from
auth.fields, the password reset link. Tokens are stored in the Keychain (after first unlock, this device only). - Feed: paging, pull to refresh, draft badges, thumbnails, and keeping the feed right after posts are added, edited or deleted. A 401 logs out.
- Post page: the site's page in a WKWebView, with
moby_view, the token only sent to the same site (including after redirects), links opened in the browser, and edit and delete in a floating toolbar. The toolbar is hosted in its own UIKit view (App/FloatingActions.swift), because SwiftUI buttons drawn over the web view didn't receive taps. - Editor:
- The description, with HTML encoding, and raw HTML editing for posts with markup.
- Media from the system photo picker, loaded as files. It's checked and named by type, HEIC is converted to JPEG without metadata, video thumbnails are made, and uploads show progress and can be retried or removed (pending uploads are deleted on the site).
- Video compression with AVAssetWriter (H.264 and AAC MP4 at the planned size and bitrate, up to 3 attempts), and the offer for videos over 200 MB. Not yet tried on a real video.
- Alt text, the full-screen viewer, and moving items earlier or later (menu and VoiceOver actions).
- Tags, with suggestions, commas, hashtag chips and limits.
- Date and time, location (with the automatic fill), status, and saving in
the specified order, with
client_id.
- Settings: the site title, and the Include Location and Publish by Default toggles.
Not done yet:
- Sharing from other apps. Needs a share extension and an App Group.
xtool supports extensions in
xtool.yml. - Drag to reorder. Items can only be moved with the menu or VoiceOver actions.
- SVG favicons.
AsyncImagecan't show them, so the letter shows instead. - Device names. Login sends the hardware identifier, such as "iPhone (iPhone15,4)", rather than "iPhone 15 Plus".
- Plain HTTP.
Info.plistallows plain HTTP to*.ddev.site,localhostand local addresses in xtool builds. App Store builds leave it out (see Releasing).