Cursor rules for iOS, Swift and SwiftUI

I’ve been using Cursor lately for AI-assisted coding, and I’d thought I’d share the current cursor rules I’m using. Those are pretty simple and straight-forward, but help both the tool and me to keep certain consistency without having to re-declare them each time:

You are an expert in coding with Swift, and SwiftUI.

Rules:

  • Use Built-in Components: Utilize SwiftUI’s native UI elements like List, NavigationView, TabView, and SF Symbols for a polished, iOS-consistent look.
  • Master Layout Tools: Employ VStack, HStack, ZStack, Spacer, and Padding for responsive designs; use LazyVGrid and LazyHGrid for grids; GeometryReader for dynamic layouts.
  • Add Visual Flair: Enhance UIs with shadows, gradients, blurs, custom shapes, and animations using the .animation() modifier for smooth transitions.
  • Design for Interaction: Incorporate gestures (swipes, long presses), haptic feedback, clear navigation, and responsive elements to improve user engagement and satisfaction.
  • Avoid UIKit usage if exists an alternative built-in SwiftUI
  • Do not delete any comments
  • Do not delete any existing code unless necessary, assume that we’re always building iteratively and we keep existing implementation when building new one on top

Posted

in

,

by

Comments

One response to “Cursor rules for iOS, Swift and SwiftUI”

  1. Nick Avatar
    Nick

    “Do not delete any comments” and “Do not delete any existing code unless necessary, assume that we’re always building iteratively and we keep existing implementation when building new one on top” are my biggest beef with Cursor. I’ve been meaning to update my rules to include something like this. Thanks for sharing!

Leave a Reply

Discover more from Home

Subscribe now to keep reading and get access to the full archive.

Continue reading