ChatGPT, iOS Developers and little missing sense.
April 20, 2023 0

By – Narendar Saini

As a powerful language model designed by OpenAI, ChatGPT can generate iOS code with ease. Writing iOS code involves using Swift, Apple’s official programming language for iOS app development, to create interactive and user-friendly applications for iPhones, iPads, and other Apple devices. With ChatGPT’s extensive knowledge of Swift syntax, UI Kit framework, and iOS development best practices, it can generate code snippets for various iOS app components such as view controllers, user interfaces, table views, navigation controllers, animations, and more. ChatGPT’s ability to generate clean and efficient Swift code, along with its understanding of iOS app architecture and design patterns, makes it a valuable tool for developers seeking assistance in their iOS app development projects.

What does it mean: ChatGPT, iOS Developers and little missing sense.

Before understanding what is “little missing sense”, let’s answer the following question:

Can we place the ChatGPT-generated code into the production code?

  • Yes
  • No

YES: this means the user knows the generated code is correct. Further, it means that the user is good at Swift/Objective C. So the user can just review the code and place it in production code. Here the only advantage of ChatGPT is just saving time. For example, if the user wants to generate network layer code or core data code or logger or something similar then ChatGPT will do this in very less time and can save many hours of work.

NO: this means the user is weak in Swift/Objective C and really didn’t understand what exactly was generated. If knowledge is limited on Swift/Objective C one should not copy-paste generated code into production code.

Have a graphical look below:

So if knowledge of Swift/Objective C is good then using ChatGPT will be harmless, because it will save time by generating the code.

But, if the knowledge of Swift/Objective C is not enough, then generated code is meaningless, and putting just copy-pasted generated code in production code will lead to nothing but danger.

From the iOS Developer’s perspective, it is not only about generating the code. There  are many big questions for the upcoming projects:

  • Which architecture should be used MVC or MVVM or MV or something else?
  • Follow Test-Driven Development or Not?
  • Which option will be better for UI design: XIB/Storyboard/Code/SwiftUI, and why? 
  • What kind of tasks can be automated for my project?
  • How to apply design patterns and design principles?
  • How to create reusable components?
  • How to modularize the app?
  • How does everything affect me if I am a sole developer or working with a team of developers or less knowledgeable than my seniors or expert than my juniors?

This list is very long by the way.

If all these questions are to be asked to ChatGPT it will give answers for each question, but here little sense will be missing in answers.

For example, regarding MVC or MVVM, ChatGPT will be able to explain but still, it will be hard to make the decision. Basically, decisions can be only taken by analyzing other factors like Is the app is big or small? 

How many developers are working on the project? 

What the complexity is? 

Is it a REST-based app or doing heavy computation?

 Does it have a few screens or fifty or a hundred screens? Many questions are there regarding architectural decisions.

Similarly, if the UI part is to be discussed, then again it will depend on various factors. For example, if there is a solo developer working then storyboards would be good or If a team of multiple developers is working then storyboarding will be a bad decision. If UI is very dynamic then custom code or SwiftUI will be a better option than XIBs and/or storyboards. Further, if the grasp on SwiftUI is good but if the teammate is not on the same page, then again decisions need to be changed.

ChatGPT can list out TDD advantages, but it can not set the mindset for writing unit test cases.

So, the idea behind writing this article is to tell every iOS developer to use their own sense because what I found on ChatGPT is missing a little sense on various important questions. It will be much better to discuss things with colleagues, peer developers, forums and so on. The best option would be a book because the author puts years of knowledge into it that can be easily grasped by a developer within a few days.

Thanks for reading this, for any questions feel free to ask, Also check out my book – iOS Developer Solution Guide

Free preview:

https://drive.google.com/file/d/1qynkqYoxhHhBLCO_aDfIULfgrMhtt94Y/view

Book on Amazon:

Leave a comment