Folders

How to open .SWIFT files (Swift source code) on Android, Windows and Linux

What .swift, .dart and .arb files are and how to open, read and edit Swift, Dart and Flutter translation files for free on Android, Windows and Linux.

Cover: Folders' text editor on two phones, labelled .SWIFT

A friend building an iPhone app sends you ContentView.swift to look over, but you’re on Android or Windows. Or you’ve been asked to check the French translations of a Flutter app, and they arrive as app_fr.arb. Neither file opens with a tap.

Both are plain text. Folders opens Swift, Dart and ARB files in its text editor on Android, Windows and Linux, so you can read them, search them and correct a line, without Xcode or Android Studio.

What is a .swift file?

A .swift file holds source code in Swift, the language Apple introduced in 2014 to replace Objective-C in apps for the iPhone, the iPad and Apple’s computers. Swift is open source, and there are official toolchains for Linux and Windows too, mostly used for server code and command-line tools. Building an iPhone app, though, still needs Xcode on one of Apple’s own computers.

Dart is in this guide because it plays a similar role on the other side. Google created it, and it’s the language of Flutter, which builds one app for Android, iPhone, Windows, Linux and the web from the same code. Folders itself is a Flutter app, so its own source is a few hundred .dart files on GitHub.

ARB files belong to Flutter as well: they hold the translated text an app shows.

Extension Language or format What it’s for
.swift Swift Source code for Apple’s platforms, and some server and command-line programs
.dart Dart Source code, almost always for a Flutter app
.arb Application Resource Bundle (JSON) An app’s text in one language, used by Flutter’s localisation tools

What’s inside an .arb file

An ARB file is JSON with one entry per message:

  • a key and its text, such as "saveButton": "Enregistrer";
  • optionally, a matching "@saveButton" entry with a description and placeholders, written for translators;
  • plural and choice messages in ICU syntax, like {count, plural, =0{No files} =1{One file} other{{count} files}}.

There’s usually one file per language: app_en.arb, app_fr.arb, app_de.arb. Flutter’s gen-l10n tool turns them into Dart code when the app is built.

How to open a .swift file with Folders

On Android

  1. Download Folders from the download section and install it on any phone running Android 7.0 or newer.
  2. Open it and tap Allow access; Android asks you to allow All files access.
  3. Find the file in its folder, or search for it by name.
  4. Tap it. A .swift, .dart or .arb file opens in the text editor.

If the file is in a message or an email, tap it there and choose Open with → Folders.

On Windows and Linux

  1. Install Folders: the setup program on Windows, or deb, rpm, AppImage, Flatpak, Snap or tar.gz on Linux.
  2. Browse to the file in Folders and double-click it.
  3. On Windows, Folders also appears in File Explorer’s Open with menu for these types: right-click → Open with → Folders.

Swift Playgrounds projects (.playground, .swiftpm) are really folders. On Windows and Linux they show up as ordinary folders: open one to find the .swift files.

What you can do with it in Folders

  • Read code in colour. Swift and Dart files are highlighted: keywords, strings, numbers, comments, type names, and attributes such as @State or @override.
  • Read ARB files as JSON. Keys, text values, numbers and true/false each get a colour, so a missing quote stands out.
  • Fix a translation. Use Find to locate a key, correct the text, and tap Save. Find and replace with Match case is handy for renaming a product name across a whole language file.
  • Compare languages. Tabs keep app_en.arb and app_fr.arb open together, so you can check one against the other.
  • Jump to errors. Compiler messages give a line number; Go to line gets you there, and Document info shows the line, column, encoding and line endings. Undo, redo, word wrap and text size make editing on a phone practical.

Folders doesn’t build or run Swift or Dart, and it doesn’t check that an ARB file is valid JSON or that its ICU messages are correct.

Other ways to open .swift files

  • Xcode, Apple’s free IDE for Swift, which runs only on Apple’s computers.
  • Visual Studio Code with the Swift extension, or with the Dart and Flutter extensions for .dart and .arb files, on Windows and Linux.
  • Android Studio with the Flutter plugin, for Flutter projects.
  • DartPad (dartpad.dev) runs small Dart programs in a web browser.

Problems opening a .swift file?

  • Flutter’s build fails after a translation edit. The commonest causes are a trailing comma after the last entry, a missing comma between entries, or an unescaped double quote inside a message. JSON allows none of these. Check the lines around the change.
  • Placeholders don’t work. A placeholder named {count} in the text has to be declared in the @ entry of the template file. A typo in either place breaks it.
  • The Swift code won’t build on Windows or Linux. Code that imports SwiftUI or UIKit depends on Apple’s frameworks, which only exist on Apple’s systems. Reading it anywhere is fine; building it isn’t.

Questions people ask

Can I open a .swift file on Android? Yes. Folders opens it as highlighted text on Android, and on Windows and Linux too. You can read and edit it, but not compile it.

Can I build an iPhone app on Windows? Not with Apple’s tools, as Xcode runs only on Apple’s computers. Flutter lets you write the app elsewhere, but the iPhone build itself still needs Xcode.

What is an .arb file? A JSON file of an app’s text in one language, used by Flutter. Translators edit the values and leave the keys alone.

.swift vs .dart: what’s the difference? Swift is Apple’s language for its own platforms. Dart is Google’s language for Flutter apps, which run on many systems from one codebase.

For Android’s own languages, see how to open Java and Kotlin files. ARB is a kind of JSON, so how to open JSON files may help too. Or see all 382 file types Folders opens.

Keep reading