Skip to content

kvn8888/OpenFoodJournal / plugins/build-ios-apps/skills/ios-simulator-browser

ios-simulator-browser

Verified

Mirror an iOS Simulator into the Codex in-app browser and render SwiftUI previews from importable Swift packages in that simulator with hot reload. Use when a user wants to watch or interact with an iOS app in the browser, see a SwiftUI preview outside Xcode Canvas, iterate live on a preview, or capture browser-visible simulator proof.

scripts/templates/FocusedPreviewHotReloadRuntime.swift

View on GitHub
import Darwin
import Foundation
import SwiftUI

// This file is compiled into the reload dylib; the running host resolves these exports with dlsym.
@MainActor private let cachedHotReloadPreviewVariants = previewBrowserPreviewVariants()

private func hotReloadPreviewCString(_ value: String) -> UnsafeMutablePointer<CChar>? {
  strdup(value)
}

@_cdecl("focused_preview_hot_reload_preview_count")
public func focusedPreviewHotReloadPreviewCount() -> Int {
  MainActor.assumeIsolated {
    cachedHotReloadPreviewVariants.count
  }
}

@_cdecl("focused_preview_hot_reload_preview_id")
@MainActor
public func focusedPreviewHotReloadPreviewID(_ previewIndex: Int) -> UnsafeMutablePointer<CChar>? {
  hotReloadPreviewCString(cachedHotReloadPreviewVariants[previewIndex].id)
}

@_cdecl("focused_preview_hot_reload_group_display_name")
@MainActor
public func focusedPreviewHotReloadGroupDisplayName(
  _ previewIndex: Int
) -> UnsafeMutablePointer<CChar>? {
  hotReloadPreviewCString(cachedHotReloadPreviewVariants[previewIndex].groupDisplayName)
}

@_cdecl("focused_preview_hot_reload_preview_display_name")
@MainActor
public func focusedPreviewHotReloadPreviewDisplayName(
  _ previewIndex: Int
) -> UnsafeMutablePointer<CChar>? {
  hotReloadPreviewCString(cachedHotReloadPreviewVariants[previewIndex].displayName)
}

@_cdecl("focused_preview_hot_reload_free_string")
public func focusedPreviewHotReloadFreeString(_ pointer: UnsafeMutablePointer<CChar>?) {
  free(pointer)
}

@MainActor
@_cdecl("focused_preview_hot_reload_make_view")
public func focusedPreviewHotReloadMakeView(
  _ previewIndex: Int
) -> UnsafeMutableRawPointer? {
  let previewVariant = cachedHotReloadPreviewVariants[previewIndex]
  // The host moves the AnyView out of this box and deallocates the storage.
  let view = UnsafeMutablePointer<AnyView>.allocate(capacity: 1)
  view.initialize(to: previewVariant.makeView())
  return UnsafeMutableRawPointer(view)
}
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall