An Android Dev Forced to Write iOS with AI Maps What Works and What Breaks
Not long ago, in a small dark room at the company, the following conversation took place.
Boss: Do you know how to write iOS code?
Me: Not at all, I've never touched it before.
Boss: Well, there's a decision from above. We want to put you in charge of the iOS side of your current project. What do you think?
Me: That project is really old. I heard it's a mix of OC and Swift. Isn't it too risky for an iOS newbie like me to jump straight in? Besides, isn't Brother A handling that project now?
Boss: Brother A has other work, he doesn't have that much energy. And anyway, we have AI now. If you don't understand something, just ask the AI.
Me: But I can't be sure if the code AI writes is correct. Can't we hire another person?
Boss: Hey, hire someone? That costs money. You know your boss has wanted a Range Rover for a long time and has been saving up. Hiring another person would cost tens of thousands more every month. You work a little harder, so the boss can get his Range Rover sooner.
Me: I see... So, can I borrow the Range Rover for a few days when the time comes?
Boss: No.
In short, the boss's point of view is that it doesn't matter if you don't understand iOS; AI can help you. So today, let's see if a newbie like me can handle iOS development with AI's help and successfully complete some upcoming iOS requirements.
What AI Can Help Me Do
Code Translation
As mentioned above, I can't read iOS code. The first thing I thought of was having AI translate for me, converting Android code with the same functionality into iOS code. This is because a former iOS colleague at my last company was learning Android development himself and used to do it this way. This time, I'll borrow his method. For example, I need to migrate a network request module from Android to iOS.
My Input to AI
AI's Output to Me
This is how it gets translated. But actually, just giving a code snippet is not enough. We can't assume that what we know, AI will definitely know. We must also tell AI some other information at the same time, such as what networking library or JSON parsing library the project uses. You can let AI scan the configuration information in the iOS project first, or you can tell it directly. Below is a prompt template.
As you can see, besides telling AI some information, you also need to ask AI to add comments to the generated code, or write down why it was written that way. In any case, you can't just give the code alone, because I am an iOS newbie right now and simply cannot read pure iOS code.
Concept Mapping
After all, both are mobile projects. iOS and Android must have many similar concepts, but the names and usages are completely different. When we see this code, how can we make it into code we are familiar with? Here, you can ask AI to help translate.
| Android | iOS | Differences |
|---|---|---|
| Activity | UIViewController | iOS has no onCreate concept; lifecycle methods differ. |
| Fragment | UIViewController (iOS has no Fragment) | iOS uses Container View or child VC to achieve similar effects. |
| Intent | URL/Target-Action/Coordinator | iOS has no Intent mechanism; routing solutions are more decentralized. |
| AndroidManifest.xml | Info.plist | Permission declarations, page registration, etc. |
| Gradle | CocoaPods / SPM / Xcode Build Settings | Dependency management differs greatly. |
| Room | CoreData / SwiftData | Room's DAO pattern and CoreData's NSManagedObjectContext thinking differ greatly. |
| SharedPreferences | UserDefaults | APIs differ but usage is similar. |
| BroadcastReceiver | NotificationCenter | Observer pattern implementation on both ends. |
| ContentProvider | No direct equivalent | iOS uses App Groups / Share Extension to achieve similar functionality. |
| ViewModel | ObservableObject / @StateObject | SwiftUI's reactive programming. |
| LiveData / Flow | Combine Framework / @Published | Data-driven UI updates. |
| DataBinding | @State / @Binding | SwiftUI's declarative binding. |
| Dagger / Hilt | Swinject / Needle | Dependency injection frameworks. |
| Glide / Coil | Kingfisher / SDWebImage | Image loading. |
How to use this table? You can talk to AI like this:
Building a Knowledge Base
I feel this is the most important point. You must establish a structured knowledge base and let AI help maintain it, like using a second brain to help me master iOS knowledge. The knowledge base structure is roughly as follows:
Things AI Can Do
- Automatically organize pitfall logs weekly: Deduplicate and categorize them into the corresponding manual.
- Generate indexes and cross-references: Make the knowledge base searchable.
- Check for outdated knowledge: Discover deprecated APIs or new version changes.
- Supplement missing chapters: Discover that I encountered a certain problem but the manual hasn't written about it yet.
No knowledge base can be built all at once; it is gradually accumulated through day-to-day requirements, problems, and experiences. In daily work, you can often ask AI to update the knowledge base, for example:
Debugging Assistance
In Android, when encountering a problem, you can basically locate the issue by looking at the logs. It's the same for iOS. If one day I have to handle an iOS crash, what should I do? Definitely look at the logs, but I can't read iOS logs. However, it doesn't matter, as long as AI can read them. For example, receiving a crash like this:
You can talk to AI like this:
AI will then give you the following response:
Code Review
As an iOS newbie with zero foundation, when working on an iOS project, it's inevitable to frequently question whether the code I just wrote is correct, or whether the code AI just generated can actually be used. At this time, you need to let AI act as a code reviewer.
Test Generation
Generally, what old projects lack the most, besides comments, is test code. This part can also be supplemented by AI.
Migration Plan Design
Sometimes the architecture patterns used on both ends are different. iOS uses MVC, and Android uses MVVM. If the architecture patterns are different, it's also difficult to achieve the code translation mentioned above. Therefore, AI needs to design a progressive migration plan.
Third-Party Library Selection
On Android, I know which library to use with my eyes closed, but on iOS, I am completely in the dark. I don't even know what third-party libraries are available, so I can only let AI help me choose.
Things AI Cannot Do
Above, I mentioned what AI can do. Of course, there are also things AI cannot do. It's impossible for me to smoothly start iOS development; some things must be done through methods other than AI.
Xcode Operations
Just as AI cannot operate the Android Studio interface, it also cannot operate Xcode's graphical interface. In particular, the following points are currently impossible:
- Certificate and Provisioning Profile Configuration: Developer accounts, certificate expiration, invalid description files—these rely purely on experience.
- Xcode Build Settings Debugging: Framework Search Paths, Other Linker Flags—error messages for these configuration items are often not intuitive.
- Archive and Export Process: Distribution certificates, Export Options.plist configuration.
- TestFlight Upload and Review: ITC (App Store Connect) operation process.
So what should be done? Don't we have a knowledge base? You can first take screenshots and record videos of all operation steps and save them into the Packaging_Signing+Release_Process.md file in the knowledge base. Each step needs to be accompanied by text descriptions, common errors, and solutions. Next time you encounter the same problem, first check your own documentation, just like taking notes.
App Store Review
I have experienced the review processes of both domestic and international Android app markets and have basically seen all kinds of weird issues. But I know nothing about the App Store review process. This requires actual hands-on experience to know. AI certainly won't be particularly accurate. For example, the following scenarios still require human intervention:
- Appeal strategies after rejection require human judgment.
- Review guidelines have many gray areas; AI's judgment may not be correct.
- The reason for an expedited review request requires human touch and social skills. If it's full of AI-speak, do you still expect them to approve it for you?
Performance Tuning
Memory and power debugging in Android requires the use of some tools, such as Android Studio's Profiler. You can't ask AI to use Profiler to help you analyze. It's the same for iOS:
- You have to know how to use the Instruments tool.
- You have to be able to troubleshoot memory leaks.
- You also need to know how to optimize rendering-related performance issues.
Legacy Code in Old Projects
There are also some issues that I am most worried about. Not to mention iOS, this has even happened in Android. It's when code unrelated to the requirements is often changed along with the rest. This code might use deprecated APIs, might use code that doesn't conform to standards, or might have logic that only the original person can understand when they come. But everyone understands that this kind of code cannot be deleted; deleting it will cause trouble. But AI doesn't know this. AI will only change the code based on your context or knowledge base, and after changing it, it almost wishes you would say thank you. Once AI deletes this "core" code, for an Android project, I can still control it and restore it. But if the same thing happens in an iOS project, as an iOS newbie, I might not notice it. The consequence is naturally that once it's submitted for testing, a bunch of problems arise. The most terrifying thing is if testing doesn't cover it and it goes directly online, then a bunch of user feedback comes chattering in.
Prompts That Might Be Used
Let's prepare a bit more. I imagined the iOS development process I might go through later and organized some prompt templates for future use.
Translating Code
I am an Android developer with zero iOS foundation. The project uses [Alamofire/Kingfisher/CoreData]. Please translate the following Android code into a Swift implementation. Requirements:
- Add comments to explain each line of code.
- Mark the corresponding Android concept in the comments.
- Provide complete, runnable code.
- Note that the project's minimum iOS version is [iOS 14].
Troubleshooting Errors
I am an iOS newbie. The compilation error is as follows: [Paste error] Related code: [Paste code] Please explain:
- Why the error occurred.
- What the equivalent error would be in Android.
- How to fix it.
Learning Concepts
I am an Android developer. Please use Android's [Concept A] as an analogy to explain iOS's [Concept B]. Provide a complete code example. Focus on explaining the differences between the two and the places where it's easy to stumble.
Code Review
Please review the following iOS code. I am a novice transitioning from Android to iOS:
- Are there any memory leak issues?
- Are there any thread safety issues?
- Does it conform to iOS best practices?
- Is there a better way to write it in Swift?
- What might not be a problem in Android but needs attention in iOS?
Finally
The above events are all real situations. If they sound familiar, then forward this article to your leaders and bosses. In the AI era, achieving multi-platform development is not impossible, but there are certain risks and thresholds. In the early stages, it's best not to have too high expectations. A certain amount of patience is needed, and a buffer time should be left for the development team to push this forward. If you are not given buffer time, then...
Top 1 of 4 from juejin.cn, machine-translated. The original thread is authoritative.
Impressive. While you're at it, write the HarmonyOS version too [onlooker eating melon]
To be honest… I'd rather take on HarmonyOS [looking] iOS is completely illegible to me [spit]
Hahaha, but it's true these days. One salary for multiple jobs is the norm