Topview Logo
  • Create viral videos with
    GPT-4o + Ads library
    Use GPT-4o to edit video empowered by Youtube & Tiktok & Facebook ads library. Turns your links or media assets into viral videos in one click.
    Try it free
    gpt video

    Cursor AI: How good is it for Swift and iOS? ?

    blog thumbnail

    Introduction

    Welcome to my exploration of a new software tool called Cursor AI, which was heavily discussed following the Apple event. Cursor AI is a development environment built around Visual Studio Code and incorporates several engaging AI features that many developers have found beneficial. In this article, I share my initial impressions of Cursor AI, particularly in the context of Swift and iOS development, and compare it to existing solutions like Apple's Predictive Code Completion and Swift Assist.

    What is Cursor AI?

    Cursor AI is a modern development environment that leverages AI to enhance coding efficiency. It integrates with code editors, allowing users to prompt edits, request explanations, and chat about code with the AI model, which uses Anthropic's Clo. This AI-driven tool appears to combine elements of existing tools like GitHub Copilot and Apple's own predictive coding features.

    Setting Up Cursor AI

    I began by creating an account on Cursor AI and opening it alongside Xcode to create a Swift project. I decided to build a simple app focused on querying the Movie Database API to list upcoming movies. This allowed me to test the capabilities of Cursor AI in a real-world scenario, utilizing Swift and iOS code.

    Features of Cursor AI

    Cursor AI offers a variety of features, including:

    • Code Highlighting and Commands: You can highlight sections of code and issue commands (like Command + K for edits) to prompt the AI.
    • Chat Functionality: Users can interact with the AI by asking questions about the codebase, obtaining explanations, and diagnosing potential bugs using Command + L.
    • Focused Editing: Highlighting a section of code and hitting Command + Shift + L allows for a more focused AI interaction.

    With these features, I hoped to see how effectively Cursor AI could assist in real coding tasks.

    Initial Coding Experience

    While developing a Movie model and a MovieService, I found Cursor AI's code completions to be generally effective, especially when referencing well-known APIs. However, as I moved beyond common patterns, the AI struggled to adapt, indicating that training data may have influenced its responses.

    Creating the View Model

    Next, I sought to implement a View Model for fetching data. Cursor AI offered a basic boilerplate, and I was able to extract certain methods, implement async updates, and even refactor some of the code. The tool made it easier to manage the model layer but occasionally made suggestions that were not optimal, leading to a deeper evaluation and revision of its suggestions.

    User Interfaces with SwiftUI

    After constructing the data layer, I turned to the View, where I noticed Cursor AI definitely accelerated development speed. However, when asked to make design tweaks, it didn’t always handle the finer details or customizations that one would expect in a typical iOS app.

    Exploring Advanced Features

    I attempted to leverage Cursor AI's capabilities for more advanced functionalities, like adding pagination to the service. While some aspects were implemented successfully, I encountered a few hiccups with duplicated movies in the response, prompting a question about potential API issues or the need for de-duplication within the app logic.

    Writing Tests

    I experimented with Cursor AI's testing abilities, asking it to generate unit tests for the MovieService and MoviesViewModel. Overall, while the AI produced usable test cases, the preparation of certain mocks felt cumbersome and not efficient.

    Summary

    In trying out Cursor AI, I discovered that it provides a helpful layer of abstraction over the coding process but is not without its limitations. While it does offer significant advantages in prompting and auto-completion, mastery of its use takes time, and it does not currently replace the traditional IDE experience entirely for iOS development. As it still leans heavily on well-known APIs and structures, developers relying on more niche integrations might find it less effective.

    Conclusion

    In conclusion, Cursor AI appears to be a promising tool for Swift and iOS development, offering a unique approach to coding assistance through AI. It reflects a broader trend towards increasing integration of AI in software development workflows, enabling developers to streamline their coding experience.

    Keywords

    Cursor AI, Swift, iOS, development tools, AI coding assistant, Visual Studio Code, predictive code completion, Xcode, model layer, SwiftUI.

    FAQ

    Q: What is Cursor AI?
    A: Cursor AI is a development environment that enhances coding by integrating AI features to assist with code editing, explanations, and interaction.

    Q: How does Cursor AI compare with Apple's development tools?
    A: While Cursor AI provides advanced auto-completion and interactive prompts, it operates differently from Apple’s native tools focusing on integration with conventional IDEs like Xcode.

    Q: Can I use Cursor AI for SwiftUI projects?
    A: Yes, Cursor AI can assist users in crafting SwiftUI code, although users may need to verify design suggestions.

    Q: What are the limitations of Cursor AI?
    A: Cursor AI is more effective with well-known APIs and tends to struggle with more niche coding patterns. Additionally, the integration with the IDE requires some effort in manual adjustments.

    Q: Is Cursor AI worth trying?
    A: If you have specific tasks or workflows benefiting from AI assistance, Cursor AI is worth exploring but may not be suitable for all coding scenarios or preferences.

    One more thing

    In addition to the incredible tools mentioned above, for those looking to elevate their video creation process even further, Topview.ai stands out as a revolutionary online AI video editor.

    TopView.ai provides two powerful tools to help you make ads video in one click.

    Materials to Video: you can upload your raw footage or pictures, TopView.ai will edit video based on media you uploaded for you.

    Link to Video: you can paste an E-Commerce product link, TopView.ai will generate a video for you.

    You may also like