Skip to content

swapify 0.5.0

Latest

Choose a tag to compare

@tornikegomareli tornikegomareli released this 04 Dec 06:47
· 1 commit to main since this release

Added

  • swapify eval '<code>' and the MCP tool eval run Swift inside the running app, once, on the main thread, without a debugger. The code compiles as a file of the app's module, so it can read and change the app's state, open a screen, or call the app's internal functions. instances(of: T.self) gives the live objects of a class, such as a model that only SwiftUI state holds. The result is the code's value, the app's log, and the screen if the code changed it.
  • Each reload, tap and eval result has the app's log since the last result: its print, Logger and NSLog lines, each line once with its count. swapify log and the MCP tool log show it on demand.
  • When the app crashes, the next command says how and where: Swift's fatal error or the uncaught exception, and the function, file and line of the app's code. Code that a reload replaced has no line, only its function and file. A crash while the app starts is reported the same way.
  • A live reload that changes nothing on screen says so: what the edit changed is not on that screen, or shows only after an action. Before, such a reload looked like any other success.

Fixed

  • On an iPhone, a reload of a file with an @Observable class failed to link: fixup error (kind=diff32) at 'l_keypath'. A key path to the class's property pointed into the class's descriptor, which a device patch takes from the app. It now goes through a pointer to the app's descriptor, so the key path also equals the app's, and the view keeps observing the model.
  • On an iPhone, the app's log arrived as one long line: the device's console ends lines with CR LF.

Changed

  • The agent protocol is version 4, for call. An app launched by an earlier swapify needs swapify run again.
  • Each launch starts a new .swapify/console.log.