Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
R0GUEEEPublic
forked from nab138/CrossCode

About

iOS Development IDE for windows/linux

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Repository files navigation

    CrossCode


Build CrossCode

iOS Swift development IDE for Windows/Linux. Create, build, and test apps without owning a Mac.

Supports Swift 6.4 (and the in-development Swift 6.5 snapshots), the iOS SDK shipped with Xcode 27.0, and the Swift Package Manager.

Demo

Demo2.mp4

Installation

CrossCode is currently in alpha. Expect bugs!

Download the latest build for your platform from releases.

Check out the Getting Started section of the wiki. Also, see Troubleshooting and FAQ

Features

  • Generate a Darwin SDK for linux from a user provided copy of the latest Xcode (e.g. Xcode 27.0) to build the apps
  • Build apps using swift package manager, or hand Xcode projects to a Mac over SSH
  • Visual SwiftUI builder: assemble views on a canvas, edit their properties, wire up tap actions, and generate the SwiftUI source
  • Import an existing Xcode project into a buildable CrossCode package
  • Log in with your Apple ID to sign apps
  • Install apps on device
  • Create projects from templates
  • Code editing including error reporting, autocomplete, go to definition, and other language features
  • Manage the project from the explorer (new file/folder, rename, delete) and with File -> New File... / File -> Save As...
  • Light/dark mode and other customizations
  • View and manage certificates, app IDs, and more
  • View the syslog or the stdout (console) of your device/app
  • Much more (and more to come!)

Future plans

The app is currently functional but does not have all the features it should. You can see a tentative plan for the future on trello

Please note that I am one person, so development may be slow. If you want to help, PRs welcome!

How it works

  • A darwin SDK is generated from a user provided copy of the latest Xcode (e.g. Xcode 27.0; extracted with unxip-rs), the darwin tools from darwin-tools-linux-llvm (currently v1.1.0), and the macro server from OpenAppleMacros (currently v1.3.0), which is what makes Apple's SwiftUI/Previews/FoundationModels macros usable on Linux.
  • Swift uses the darwin SDK to build an executable which is packaged into an .app bundle.
  • The code to sign and install apps onto a device has been removed from CrossCode's source and moved to a standalone package, isideload. It was built on a lot of other libraries, so check out its README for more info.

UI Builder

View -> Panels -> UI Builder opens a visual editor for SwiftUI views next to the code editor:

  • the Package and Target pickers at the top choose what the builder writes into; it follows the file that is open in the editor and can also be pointed at any other Swift package folder on disk (each package keeps its own layout file),

  • drag components from the palette onto the canvas (or click to append them),

  • select a view to edit its properties, bindings and modifiers in the inspector,

  • give a view a tap action: a button runs its action in its own closure and any other view gets an .onTapGesture. Pick what happens — flip a toggle, add to or subtract from a number, assign a value, or dismiss the view — and name the state variable it changes; the little preview in the inspector shows the Swift that will be emitted, and @State (or @Environment(\.dismiss)) is declared for you,

  • reorder, duplicate or delete views in the structure tree, and

  • watch the generated SwiftUI code update live.

Save <View>.swift writes the result to <project>/Sources/<View>.swift, which Open in Editor then opens in Monaco. The layout itself is stored in the project as .crosscode/ui-builder.json (the same folder that keeps your open tabs), so it survives restarts. Controls that need state (Toggle, TextField, Slider, ...) declare their @State variables automatically.

The canvas is a preview approximation, not a simulator; build the app to see the real thing on a device.

Files and editing

The project explorer shows the folder you opened. Right click an entry to create a file or folder inside it, rename it, delete it, reveal it in the file manager or open it in the UI Builder. File -> New File... (Ctrl+N) asks for a path inside the project and opens the result; File -> Save As... (Ctrl+Shift+S) writes a copy of the file in the editor and switches to it.

The editor is a full Monaco workbench wired to the same files through a custom file system provider, so creating, renaming and deleting folders works from both sides and the editor is told about changes made outside the app.

Package metadata

CrossCode reads the manifest when it opens a package and shows what it found in the project bar:

  • iOS 17.0+ — the deployment target the manifest declares. A package that declares other platforms but no iOS gets a warning instead, because building it for a device is likely to fail.
  • N asset catalogs — .xcassets bundles were found. They cannot be compiled on Linux (actool lives in Xcode), so their contents are copied into the app bundle as files instead of being compiled into Assets.car; the badge says so, and the tooltip names the folders.
  • N warnings — anything else worth knowing before a build, such as a target that cannot be built for iOS.

The metadata also feeds the packer: resource folders the manifest declares (or the ones found next to a target's sources, Resources/ and assets/) are copied into the bundle, preserving their layout, rather than only the Resources/ folder at the project root.

Building on a remote Mac

An .xcodeproj or .xcworkspace cannot be built with SwiftPM on Linux, so for those projects CrossCode can hand the build to a Mac you already own over SSH. Open the Remote Mac button in the project bar (it is only shown for Xcode projects and workspaces):

  1. turn on Use this Mac for Xcode builds,
  2. enter the host, the macOS user and the port,
  3. choose how to authenticate — the SSH agent/default key, or a private key file you pick with Browse (the file has to exist on the machine running CrossCode),
  4. enter the path of the project on the Mac (the folder, not the .xcodeproj — CrossCode adds the entry point itself),
  5. optionally set an xcodebuild destination (generic/platform=iOS, platform=iOS Simulator,name=iPhone 17, ...), a result bundle path and switch on Run tests instead of building,
  6. Test Connection runs xcodebuild -version over the same SSH settings, so a mistake in the key, the host or the port is reported before a build starts.

Build .ipa (Debug/Release) and Test Selected Workspace then run their xcodebuild invocation on the Mac, and the output (including compiler diagnostics) streams into the normal build console. Paths printed by the remote Mac are mapped back onto your local workspace, so a problem in the Problems panel opens the right file and line locally.

What this does not do: it does not upload your sources. The Mac builds the copy of the project that is in projectPath on its own disk, so keep the two in sync (git, a shared folder, a sync tool). If the local and remote copies differ, the build reflects the remote one.

Import Xcode Project on the welcome page (or File -> Open -> Import Xcode Project...) converts an existing .xcodeproj into a package CrossCode can build and install:

  1. pick the folder containing the project,
  2. review the plan: the app target, the files that will be created, the package dependencies that were found and every warning,
  3. import — CrossCode writes Package.swift, crosscode.toml and an Info.plist, and copies plain resources into Resources/.

The sources stay where they are: the generated manifest points at them with path: and exclude:, so Xcode and CrossCode keep working on the same files.

What the importer does and does not do:

  • framework targets become libraries and app targets become the executable product (swift-tools-version: 6.4, platforms: [.iOS("<deployment target>")]),
  • local Swift packages (including the folder references Xcode creates when you add a package without a PackageReference) and remote package URLs are carried over into Package.swift,
  • the Info.plist is converted: the fields CrossCode manages become [[bundle_id]], [[product]], [[version_num]] and [[version_string]], and every other $(SETTING) is expanded from the project's build settings,
  • only one app target is imported (SwiftPM cannot have two targets compiling the same files), test targets and app extensions are skipped, and a file compiled by several targets is assigned to the app,
  • asset catalogs, storyboards and Metal sources cannot be compiled on Linux (they need actool, ibtool or the Metal toolchain from Xcode), so apps that depend on them will build without those assets,
  • shared files, alternate app targets and remote package requirements are reported as warnings rather than silently dropped.

Credits

  • idevice is used to communicate with iOS devices.
  • xtool has been used as a reference for the implementation of the darwin SDK generation.
  • Sideloader has been heavily used as a reference for the implementation of the Apple Developer APIs and sideloading process.
  • GNU cpio 2.14 is included under GPLv3 (see licenses/GPL-3.0.txt), with its copyright holders. See Source code. It is used to help with XIP extraction.

AI Usage

  • Helped port small sections of code from Sideloader because I'm not familiar with dlang syntax

About

iOS Development IDE for windows/linux

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages