Article

Optimizing Mobile App Development Workflows with Generative AI

IOSDevelopment_Header_v02_JS

Mobile app development has come a long way. With Generative AI, the practice is set to become increasingly sophisticated and powerful.

Not long ago, developers had to deal with constraints and limited capabilities when creating complex and user-friendly applications. Fortunately, things have changed. By leveraging various frameworks, developing cross-platform mobile apps is easier than ever. These frameworks allow developers to write code once and run it on iOS and Android platforms, simplifying the development process. Of course, there’s still the option to go the native route for each platform if needed, providing flexibility and customization based on specific platform requirements.

An additional advance in mobile app development has come through Artificial Intelligence (AI), which has also taken significant strides with its groundbreaking ideas. 

Outside the context of development, tools like ChatGPT or Fresh’s proprietary tool, Brancher.AI, can assist with various tasks, from telling you what to watch next, writing a poem, generating code, or allowing you to create your own low-code apps. By creating detailed, high-quality prompts, Generative AI can be used to create customized code snippets and much more. 

Let’s explore the perks of using AI and how it can boost developers’ productivity and problem-solving skills.

An interface for a Fresh mobile app created for the wholesale food industry.

#1: Use Generative AI to generate V1 code snippets

Writing User Interface (UI) code can become time-consuming and repetitive. 

Take, for instance, creating a screen with a text title, two centrally aligned text fields, each accompanied by a text description, and a rounded button – a classic login screen. AI can come to the rescue by providing a jumpstart on various tasks. It can generate code snippets or general components you can build upon or refactor as needed. 

Dealing with simple yet tedious components can be a breeze, with the ability to request and implement them quickly, significantly boosting productivity and efficiency. Of course, you’ll still need to tweak the code to match your desired design.

Optimizing the time saved presents an opportunity to enhance the overall technology architecture, ensuring responsiveness and reusability of components. Additionally, more time to complete other tasks can accelerate production, leading to quicker project completion. Optimized development workflows for mobile apps and web apps allow your team to gain the confidence of clients and establish a dependable reputation for your contributions.

However, with AI-generated V1 code snippets, avoid the temptation to copy and paste code directly into your project and call it a day. This shortcut might lead to potential data leaks, impacting the privacy and security of your application. Taking the time for careful implementation is crucial to ensure a safer development process.

Fresh built "Easy Lease," a mobile app for real estate brokers.

#2: Generative AI (typically) follows best practices for coding

Depending on the prompt, especially when multiple similar components are involved, the AI might suggest creating a custom component class. This approach encourages code reuse, making it more convenient and aligning with software development practices

When the code is generated, you’ll notice that it adheres to principles like proper naming for human readability, following naming conventions, utilizing leading underscores for local identifiers, and extracting embedded function logic to dedicated functions, thereby reducing complexity and enhancing maintainability. These practices encourage a positive habit of crafting clean, readable, and easily maintainable code.

While AI can generate code, developers are responsible for aligning it with the prevailing architectural standards. Grasping these fundamental principles is pivotal for expediting the development process. It’s essential to view AI as a tool that enhances your work rather than relying on it as a substitute for the developer’s role.

Mobile app strategy is a key component of Fresh's development approach.

Tip #3: Generative AI can illustrate different approaches to the same problem

AI proves incredibly helpful by offering various approaches to tackle the same problem. When revisiting past projects, opportunities often emerge to enhance logic for increased efficiency and readability. However, adjusting the logic can impede development, introducing time-consuming complexities. The need for refactoring becomes apparent, especially when integrating new features, contributing to an overall increase in time investment. Spotting these potential improvements ahead of time could significantly streamline our workflow. 

Moreover, it would facilitate the smooth onboarding of new developers, ensuring a more organized architecture and promoting consistency among team members in following established procedures.

If you’ve already implemented logic for a feature or any general scenario, you can ask the AI to demonstrate an alternative approach to the existing code. This capability provides a fresh perspective and may present a more effective solution than what you initially devised. 

Another way to leverage this feature is by requesting specific logic, such as asking how to detect internet connection status in an iOS app. AI is likely to generate a method for checking internet connections. It will provide an alternative solution if you ask for a different approach. You can compare both versions and choose the one that best suits your needs or continue asking for different approaches to refine your solution.

Interface design is also an essential component of Fresh's mobile app development approach.

Tip #4: Generative AI is a great tool for troubleshooting coding challenges

AI is a valuable resource when troubleshooting code issues. We often spend considerable time staring at code, struggling to identify seemingly trivial bugs causing significant problems. 

In the past, when encountering a new issue, the standard approach was to resort to Google and search for a solution, often relying on Stack Overflow to find relevant answers. However, this process was only sometimes straightforward, as the solutions might not precisely match the problem. The contemporary alternative is turning to AI, where you can articulate a specific question and receive a tailored solution to your unique challenge.

Imagine you have a button meant to be centered, red-colored, and rounded corners, but it displays something different. In such cases, you can copy and paste that section of code, asking the AI why it’s not showing the expected design. 

Alternatively, you can describe your desired design, and the AI will generate the code to achieve that UI. You can pinpoint discrepancies and rectify issues by comparing the generated code with your own.

AI is handy for solving and debugging problems, but ensuring no sensitive data is shared is crucial. Avoid including extensive code to prevent potential data leaks, which could impact the privacy and security of your app. Always maintain your client’s security—a fundamental commitment of Fresh’s development practice—by refraining from sharing anything with sensitive data or information.

Fresh's creates mobile apps with a variety of features, including biometrics.

Tip #5: Consider AI when exploring useful packages

AI can suggest useful packages that might be new to you but could save considerable time. 

Picture this: you’re working on creating a button that, when tapped, opens the user’s camera to take a photo. Of course, this involves device access and permissions. No peeking into someone’s camera roll without permission, right? 

AI can simplify this by generating code using a popular library – the one everyone’s using. Feeling a bit adventurous and want to try a different library? Just let AI know, and it’ll generate the code for that. 

If you run into any issues with the code, paste the error, and it’ll either find a better solution or tweak the code. If you’re already leaning towards a specific library, mention its name in your prompt, and AI will provide code tailored to that particular library. 

A quick tip: do some research before settling on a library. AI might have different info, so ensure you pick the latest and most suitable packages for your project.

Fresh designs mobile apps for various industries, including sports and entertainment.

Tip #6: AI is a great tool to help with testing

Developers often perceive testing as less critical, considering it tedious, time-consuming, and sometimes seemingly inconsequential since it doesn’t directly impact the final application. While this perspective may have some validity, it doesn’t diminish the value of development testing, especially in the context of large development teams. Testing plays a vital role in bug detection, quality assurance, reliability, stability, and security, to name a few.

AI presents a transformative opportunity to elevate the testing process by automating and enhancing various aspects. This capability includes crucial functions such as test case generation, automated test scripting, test execution, regression testing, performance testing, and more. Even when a test may not be flawless, AI allows for adaptability, enabling developers to tweak and tailor it to their specific application needs.

To maximize the benefits of testing, it’s essential to establish a structured testing framework and adhere to it consistently. Avoid creating similar tests, as this can lead to inefficiencies. AI can optimize the testing process, ensuring a more systematic and effective approach.

You can go to ChatGPT and ask this (for this example, I will be using Flutter framework): 

using flutter: create unit test for a rounded button with border yellow lines, blue colored, and an image as child”

This prompt initiates the creation of a button component class based on the provided description. Subsequently, it generates a testing class to evaluate the properties outlined in the prompt for the aforementioned component. This serves as a typical illustration of how effortlessly AI can assist in generating test classes and cases tailored to a specific component.

We also designed All Day, a health and wellness app for Adidas.

Consider Generative AI for development assistance, but always use it wisely

AI is a fantastic resource for generating code snippets and getting a head start on various tasks, all while promoting adherence to best coding practices. It excels at providing different approaches to tackle the same problem and even offers guidance on the most suitable method, taking into account your architecture. This proves invaluable for troubleshooting and tailoring solutions to specific issues you may encounter in your coding journey. Furthermore, AI introduces you to and suggests applicable packages for your tasks and can change your perspective when considering testing.

Embracing AI tools can reclaim precious time for you. Even small time savings, when accumulated, translate into minutes, then hours. This saves clients money, results in shorter project timelines, and allows resources to be redirected to more valuable tasks.

While AI is an excellent tool for development, it’s crucial to couple its insights with personal learning and understanding. Familiarity with the logic extracted from AI is essential to mitigate potential security risks or performance issues. 

Use AI wisely by leveraging its strengths while maintaining a comprehensive understanding of the code it generates. If you’re interested in learning more about our perspective, need consultation on your own use of AI, or are seeking assistance on your latest project, let’s connect!

Ricardo Colin Picture

Ricardo Colin

Sr. Mobile Developer

Ricardo comes to Fresh with experience in creating websites and custom applications for smaller companies from when he was in college, with a focus on mobile development. After developing Android applications on Java, he transitioned to iOS using Swift. Then, once Flutter developed a cross-platform technology, Ricardo became intrigued and began using that framework for future applications.

Ricardo also enjoys guiding and helping other devs and peers with projects, previously acting as a part-time coach to students with Flutter and Firebase projects. In addition, Ricardo has two Flutter game applications in the App Store and the Play Store: “Math Circle Roulette,” which helps with practicing math problems, and “What’s My Number?” a guessing game that you can play with other friends or with a robot.

Ricardo loves to learn and talk about almost anything, especially about new technology and finding new opportunities to exchange knowledge. Outside of work, he loves to learn about new places to hike and will play soccer from time to time.