Overview
NativeBridge is a production-ready code conversion tool that transforms entire iOS apps to Android (and vice versa) with 96% simple SwiftUI accuracy, 75-80% complex, 107+ conversion patterns, and automatic library detection. Our intelligent conversion engine analyzes your code structure, detects libraries (Alamofire, Realm, Firebase), auto-generates build.gradle with all dependencies, and converts SwiftUI → Jetpack Compose and UIKit → Android Views.
Key Features
Quick Start
Converting your first file takes less than a minute:
Go to the Converter
Navigate to the converter page and upload your file. The conversion direction is auto-detected from the file extension.
Upload Your File
Drag and drop your .swift or .kt file, or click to browse. Maximum file size is 5MB.
Configure API Mappings
If platform-specific APIs are detected, you'll see a configuration screen. Select your preferred implementations or mark for custom handling.
Download Your Code
Click convert and download your converted file. For complex conversions, you'll receive a ZIP package with documentation.
Supported Formats
| Format | Extension | Max Size | Notes |
|---|---|---|---|
| Swift | .swift |
5MB | Swift 5.x syntax supported |
| Kotlin | .kt |
5MB | Kotlin 1.9+ syntax supported |
| ZIP Archive | .zip |
10MB | Batch mode only |
Understanding Project Sizes
NativeBridge pricing is based on LOC (Lines of Code), not individual files. Here's how to estimate your needs:
| Project Size | Typical LOC | Recommended Plan | Examples |
|---|---|---|---|
| Small | 5,000-15,000 LOC | Solo ($1,499) | MVP app, proof-of-concept, small utility, 2-3 apps |
| Medium | 15,000-50,000 LOC | Professional ($4,999) | Production app with multiple modules, 12-13 apps |
| Large | 50,000-150,000 LOC | Enterprise Monthly ($4,999/mo) or Annual ($47,988/yr) | Complex app with extensive features |
| Multiple Large Projects | 150,000+ LOC | Enterprise Annual ($47,988/yr) | Multiple complex apps, ongoing client work, 150 apps/year |
find . -name "*.swift" -exec wc -l {} + | tail -1 (or *.kt) in your project directory to count total lines of code. LOC counts only non-empty, non-whitespace lines.
Single File Conversion
Single file mode is the default conversion method. Upload one file at a time and receive the converted output directly.
How It Works
struct User {
let id: UUID
var name: String
var email: String?
func displayName() -> String {
return name.capitalized
}
}
data class User(
val id: UUID,
var name: String,
var email: String? = null
) {
fun displayName(): String {
return name.replaceFirstChar { it.uppercase() }
}
}
Batch Processing
Batch mode allows you to convert entire project directories at once. Upload a ZIP file containing your source files and receive a converted ZIP with the same folder structure.
ZIP Requirements
.swift or .kt fileProgress Tracking
During batch conversion, you'll see real-time progress including:
API Mapping
When NativeBridge detects platform-specific APIs in your code, it provides a configuration screen with mapping options.
Detected API Categories
| iOS (Swift) | Android (Kotlin) | Common Alternative |
|---|---|---|
| UIKit | Android Views | Compose/SwiftUI patterns |
| CoreData | Room | SQLDelight (KMM) |
| URLSession | OkHttp/Retrofit | Ktor Client |
| UserDefaults | SharedPreferences | DataStore |
| Combine | Flow/RxJava | Kotlin Flow |
Mapping Options
For each detected API, you can choose:
Output Package
Complex conversions generate a ZIP package containing multiple files to help you integrate the converted code.
Package Contents
project-converted/
├── README.md # API mapping summary
├── TODO-CHECKLIST.md # Integration tasks
├── converted/ # Converted source files
│ └── [your files].kt
└── templates/ # Generated helper files
└── [helper files].kt
README.md
Contains a summary of the conversion including:
TODO-CHECKLIST.md
A markdown checklist of tasks to complete your integration:
Swift to Kotlin
Key transformations when converting from Swift to Kotlin:
| Swift | Kotlin |
|---|---|
struct | data class |
class | class |
let | val |
var | var |
func | fun |
guard let | ?: return |
if let | ?.let { } |
protocol | interface |
extension | Extension function |
enum with associated values | sealed class |
Kotlin to Swift
Key transformations when converting from Kotlin to Swift:
| Kotlin | Swift |
|---|---|
data class | struct |
class | class |
val | let |
var | var |
fun | func |
?.let { } | if let |
interface | protocol |
| Extension function | extension |
sealed class | enum with associated values |
object | class with static members |
Type Mapping
Standard library type mappings:
| Swift | Kotlin |
|---|---|
String | String |
Int | Int |
Double | Double |
Bool | Boolean |
Array<T> / [T] | List<T> |
Dictionary<K, V> | Map<K, V> |
Set<T> | Set<T> |
T? | T? |
Any | Any |
Void | Unit |
Platform APIs
Platform-specific APIs cannot be directly converted. NativeBridge detects these and provides mapping suggestions.
iOS APIs Detected
UIKit
UI components and view controllers
CoreData
Object persistence
CoreLocation
Location services
AVFoundation
Audio/video playback
UserNotifications
Push notifications
StoreKit
In-app purchases
Android APIs Detected
android.view
UI components
Room
Database persistence
FusedLocationProvider
Location services
ExoPlayer
Media playback
Firebase Messaging
Push notifications
Google Play Billing
In-app purchases
SwiftUI → Jetpack Compose
NativeBridge converts SwiftUI to Jetpack Compose with 96% accuracy on simple patterns, 75-80% on complex patterns. This comprehensive guide shows how each SwiftUI component maps to its Compose equivalent.
Layout Components
| SwiftUI | Jetpack Compose | Description |
|---|---|---|
VStack |
Column |
Vertical stack with alignment and spacing |
HStack |
Row |
Horizontal stack with spacing |
ZStack |
Box |
Overlay stack for layering views |
Lists & Grids
| SwiftUI | Jetpack Compose | Description |
|---|---|---|
List |
LazyColumn |
Efficient scrolling list |
LazyVGrid |
LazyVerticalGrid |
Vertical grid with adaptive/fixed columns |
LazyHGrid |
LazyHorizontalGrid |
Horizontal grid layout |
ScrollView |
verticalScroll / horizontalScroll |
Scrollable modifier for Column/Row |
ForEach |
items() / itemsIndexed() |
Iterate over collections |
State Management
| SwiftUI | Jetpack Compose | Description |
|---|---|---|
@State |
remember { mutableStateOf() } |
Local mutable state |
@Binding |
Callback functions | Two-way data binding via parameters |
@ObservedObject |
ViewModel with StateFlow |
Observable ViewModel pattern |
@EnvironmentObject |
CompositionLocal |
App-wide shared state |
Input & Forms
| SwiftUI | Jetpack Compose | Description |
|---|---|---|
TextField |
OutlinedTextField / TextField |
Text input with Material styling |
Toggle |
Switch |
Boolean toggle control |
Button |
Button / OutlinedButton |
Clickable button with styling |
DatePicker |
DatePicker (Material3) |
Date selection dialog |
Picker |
ExposedDropdownMenuBox |
Dropdown selection menu |
Slider |
Slider |
Range slider with steps |
Navigation
| SwiftUI | Jetpack Compose | Description |
|---|---|---|
NavigationView + NavigationLink |
NavHost + NavController |
Screen navigation with routes |
Styling & Modifiers
| SwiftUI | Jetpack Compose | Description |
|---|---|---|
.padding() |
Modifier.padding() |
Add spacing around content |
.background() |
Modifier.background() |
Background color or shape |
.frame() |
Modifier.size() / width() / height() |
Set component dimensions |
.clipShape() |
Modifier.clip() |
Clip to shape (Circle, RoundedCorner) |
Image |
Image / AsyncImage (Coil) |
Display images with scaling |
Animations & Gestures
| SwiftUI | Jetpack Compose | Description |
|---|---|---|
withAnimation |
animate*AsState |
Animate state changes |
.transition() |
AnimatedVisibility |
Enter/exit transitions |
DragGesture |
pointerInput { detectDragGestures } |
Handle drag interactions |
onLongPressGesture |
combinedClickable |
Long press detection |
Responsive Design
| SwiftUI | Jetpack Compose | Description |
|---|---|---|
GeometryReader |
BoxWithConstraints |
Access parent size for responsive layouts |
Complex Forms
| SwiftUI | Jetpack Compose | Description |
|---|---|---|
Form with Section |
Column with Card sections |
Sectioned form layout |
UIKit → Android Views
NativeBridge converts 26 UIKit patterns to Android Views with XML layouts. Each UIViewController maps to an Activity with corresponding XML resources.
Controllers & Activities
| UIKit | Android Views | Description |
|---|---|---|
UIViewController |
Activity + XML layout |
View controller lifecycle → Activity lifecycle |
Text & Display
| UIKit | Android Views | Description |
|---|---|---|
UILabel |
TextView |
Text display with styling |
UIImageView |
ImageView |
Image display with scaling modes |
Input Controls
| UIKit | Android Views | Description |
|---|---|---|
UIButton |
Button / MaterialButton |
Clickable button with target-action |
UITextField |
EditText / TextInputLayout |
Single-line text input |
UITextView |
EditText (multiline) |
Multi-line text input |
Selection Controls
| UIKit | Android Views | Description |
|---|---|---|
UISwitch |
Switch / SwitchMaterial |
Boolean toggle control |
UISegmentedControl |
TabLayout |
Segmented picker control |
UISlider |
SeekBar / Slider |
Range slider with min/max |
Progress Indicators
| UIKit | Android Views | Description |
|---|---|---|
UIProgressView |
ProgressBar (horizontal) |
Linear progress indicator |
UIActivityIndicatorView |
ProgressBar (indeterminate) |
Circular loading spinner |
Collections & Lists
| UIKit | Android Views | Description |
|---|---|---|
UITableView |
RecyclerView + LinearLayoutManager |
Vertical scrolling list with ViewHolder pattern |
UICollectionView |
RecyclerView + GridLayoutManager |
Grid layout with custom item size |
UIStackView |
LinearLayout |
Linear arrangement of subviews |
Navigation
| UIKit | Android Views | Description |
|---|---|---|
UINavigationController |
Navigation Component |
Fragment-based navigation with back stack |
UITabBarController |
BottomNavigationView |
Tab-based navigation at bottom |
UIBarButtonItem |
Menu items in Toolbar |
Action bar buttons |
Layout & Constraints
| UIKit | Android Views | Description |
|---|---|---|
Auto Layout Constraints |
ConstraintLayout attributes |
Declarative layout constraints in XML |
NSLayoutConstraint multiplier |
layout_constraintWidth/Height_percent |
Percentage-based sizing |
Scroll & Refresh
| UIKit | Android Views | Description |
|---|---|---|
UIScrollView |
ScrollView / NestedScrollView |
Scrollable container for content |
UISearchBar |
SearchView |
Search input in action bar |
UIRefreshControl |
SwipeRefreshLayout |
Pull-to-refresh gesture |
Dialogs & Alerts
| UIKit | Android Views | Description |
|---|---|---|
UIAlertController |
AlertDialog / MaterialAlertDialog |
Modal alert with actions |
WKWebView |
WebView |
Embedded web browser |
Advanced Interactions
| UIKit | Android Views | Description |
|---|---|---|
UIPageViewController + UIPageControl |
ViewPager2 + TabLayout |
Swipeable pages with indicators |
UIGestureRecognizer |
GestureDetector |
Tap, swipe, pan, pinch gestures |
Auto-Generated build.gradle
NativeBridge automatically generates a complete build.gradle file with all required dependencies based on detected libraries. This achieves 85%+ compilation rate out of the box.
How It Works
Example Output
If your Swift code uses Alamofire, Realm, and Kingfisher, the generated build.gradle includes:
// Auto-generated by NativeBridge
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'kotlin-parcelize'
}
dependencies {
// Networking (Alamofire → Retrofit)
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
// Database (Realm → Room)
implementation 'androidx.room:room-runtime:2.6.1'
kapt 'androidx.room:room-compiler:2.6.1'
implementation 'androidx.room:room-ktx:2.6.1'
// Image Loading (Kingfisher → Coil)
implementation 'io.coil-kt:coil-compose:2.5.0'
// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
}
Supported Libraries
| iOS Library | Android Equivalent | Dependencies Added |
|---|---|---|
Alamofire |
Retrofit + OkHttp |
retrofit2, okhttp3, converter-gson |
Realm Swift |
Room |
room-runtime, room-compiler, room-ktx |
RxSwift |
Kotlin Flow |
kotlinx-coroutines-android |
Kingfisher |
Coil |
coil-compose or coil |
KeychainAccess |
EncryptedSharedPreferences |
androidx.security:security-crypto |
URLSession |
OkHttp / Ktor |
okhttp3, ktor-client-android |
Firebase iOS SDK |
Firebase Android SDK |
firebase-auth, firebase-firestore, etc. |
SwiftUI |
Jetpack Compose |
compose-ui, material3, compose-tooling |
UIKit |
Android Views |
appcompat, constraintlayout, material |
Combine |
Kotlin Flow |
kotlinx-coroutines-android |
How to Use
Download Converted Code
Download the ZIP package containing your converted code and build.gradle file.
Find build.gradle.example
Locate the build.gradle.example file in the downloaded package.
Copy to Your Project
Copy the dependencies and plugins to your project's app/build.gradle file.
Sync Project
Click "Sync Project with Gradle Files" in Android Studio. Code compiles with 85%+ success rate!
Smart TODO Templates
When full automatic conversion isn't possible, NativeBridge generates working code templates with inline examples. These aren't just comments—they're copy-paste ready implementations.
What Are TODO Templates?
TODO templates provide functional code scaffolds for patterns that require manual customization. Each template includes:
- Original code: Your Swift code preserved as a comment for reference
- Working implementation: Kotlin code ready to use
- Inline documentation: Explanations of the conversion approach
- Usage examples: How to integrate the converted code
Example: Network Request
// TODO: ALAMOFIRE → RETROFIT CONVERSION
// Original Swift: AF.request(urlString).responseJSON { response in ... }
//
// Retrofit equivalent:
interface ApiService {
@GET("endpoint")
suspend fun getData(): Response<JsonObject>
}
// Usage in ViewModel:
viewModelScope.launch {
try {
val response = retrofit.create(ApiService::class.java).getData()
// Handle response
} catch (e: Exception) {
// Handle error
}
}
When Templates Are Used
Conversion Examples
Real-world examples showing complete conversions from Swift to Kotlin.
SwiftUI View → Jetpack Compose
A common user profile screen with state management and navigation:
struct ProfileView: View {
@State private var username = ""
@State private var isEditing = false
var body: some View {
VStack(spacing: 20) {
Text("Profile")
.font(.title)
TextField("Username", text: $username)
.textFieldStyle(RoundedBorderTextFieldStyle())
Button("Edit") {
isEditing.toggle()
}
}
.padding()
}
}
@Composable
fun ProfileView() {
var username by remember { mutableStateOf("") }
var isEditing by remember { mutableStateOf(false) }
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(20.dp)
) {
Text(
text = "Profile",
style = MaterialTheme.typography.titleLarge
)
OutlinedTextField(
value = username,
onValueChange = { username = it },
label = { Text("Username") },
modifier = Modifier.fillMaxWidth()
)
Button(onClick = { isEditing = !isEditing }) {
Text("Edit")
}
}
}
Data Model Conversion
Converting Swift structs to Kotlin data classes:
struct User: Codable {
let id: UUID
var name: String
var email: String?
var isActive: Bool
}
@Serializable
data class User(
val id: UUID,
var name: String,
var email: String? = null,
var isActive: Boolean
)
Library Conversions
NativeBridge automatically converts 14 popular iOS libraries to their Android equivalents. All conversions are listed in the build.gradle section above.
Supported Conversions
The following library conversions are fully automated:
- Alamofire → Retrofit: HTTP networking with request/response handling
- Realm → Room: Local database persistence with migrations
- RxSwift → Kotlin Flow: Reactive programming patterns
- Kingfisher → Coil: Asynchronous image loading and caching
- KeychainAccess → EncryptedSharedPreferences: Secure key-value storage
- URLSession → OkHttp: HTTP client for REST APIs
- Firebase iOS SDK → Firebase Android SDK: Authentication, Firestore, Analytics
- Combine → Kotlin Flow: Reactive data streams
Each library conversion includes proper imports, initialization code, and usage examples. See the Auto-Generated build.gradle section for complete dependency information.
Code Preparation
For best results, prepare your code before conversion:
Isolate Business Logic
Separate platform-independent code from UI and platform APIs. This code converts cleanly.
Use Protocols/Interfaces
Define platform dependencies behind interfaces. This makes them easy to replace post-conversion.
Add Type Annotations
Explicit type annotations improve conversion accuracy, especially for complex generics.
Simplify Closures
Break complex nested closures into named functions for cleaner conversion.
Post-Conversion
After conversion, follow these steps to integrate your code:
Review the README
Check the generated README.md for conversion notes and API mappings applied.
Add Dependencies
Install any required libraries listed in the TODO checklist.
Implement Platform APIs
Replace TODO markers with actual platform implementations.
Run Tests
Port your unit tests and verify behavior matches the original.
Compile and Fix
Address any compiler errors. Most are minor type adjustments.
Troubleshooting
Ensure your file contains valid syntax. Try compiling it first. If using Swift, ensure Swift 5.x syntax. For Kotlin, ensure 1.9+ compatibility.
This indicates heavy platform API usage. Consider isolating business logic first, then converting. Platform APIs require manual implementation.
Add explicit type annotations to your source code. The converter relies on type information to make accurate mappings.
Check the error list in your output. One file may have a syntax error. Fix it and re-upload. Successfully converted files are still included in the output.