Rule
0 installs · 0 said it worked
Cursor rules enforcing UIKit programmatic UI and MVC separation
Cursor rule file that guides Swift/UIKit code generation: SnapKit auto layout, no Storyboards or XIBs, factory-based view creation so UI components never touch models, and closure-based events passing self.
People use this for
- swiftui uikit cursor rules
- uikit snapkit programmatic layout
- swift mvc view factory pattern
- ios closure event passing self
- no storyboard uikit code generation
- Name
cursor-rules-enforcing-uikit-programmatic-ui-and-mvc-separation- Works with
- Cursor
- License
- CC0(as observed at the source)
- Version
- v1 · updated Nov 29, 2026
Imported on Nov 29, 2026 from github.com . License observed at the source on Nov 29, 2026: CC0.
Are you the author?Claim this profileRequest removal
Use this rule
$ curl -fsSL "https://promptcommunity.dev/api/v1/posts/cursor-rules-enforcing-uikit-programmatic-ui-and-mvc-separation-327y/export/mdc" -o .cursor/rules/cursor-rules-enforcing-uikit-programmatic-ui-and-mvc-separation.mdcThen open a new session; Cursor picks it up from .cursor/rules/.
Manual install
Save cursor-rules-enforcing-uikit-programmatic-ui-and-mvc-separation.mdc as .cursor/rules/cursor-rules-enforcing-uikit-programmatic-ui-and-mvc-separation.mdc for this project or ~/.cursor/rules/cursor-rules-enforcing-uikit-programmatic-ui-and-mvc-separation.mdc for every project, then start a new session.
Rule
description: "Cursor rules for UIKit development guidelines." globs: */ alwaysApply: false
you are an expert in coding with swift, iOS, UIKit. you always write maintainable code and clean code. focus on latest documentation and features. your descriptions should be short and concise. don't remove any comments.
UIKit UI Design Principles:
- Auto Layout: Implement responsive layouts using SnapKit only (avoid NSLayoutConstraint for better readability), support Dynamic Type and Safe Area
- Programmatic UI: Avoid Storyboards/XIBs, implement all UI components directly in code (UIView, UIButton, UITableViewCell). Use view composition and custom view subclasses for reusability
- UI Components must not directly access models or DTOs. Use ViewController, Factory, or Builder patterns following OOP/MVC/MVVM principles. Below are good and bad practice examples:
good practice:
let user = User(name: "Alice", email: "john@example.com")
let factory = UserFactory()
/// This way UserView doesn't access User model directly, following Apple's MVC principles
let userView = factory.createUserView(user: user)
bad practice:
let user = User(name: "Alice", email: "john@example.com")
/// This exposes UserView to User model, violating MVC principles
let userView = UserView(user: user)
- UI components should pass events using closures, and the closure must pass 'self' as a parameter to allow external objects to identify the source component
class SampleView: UIView {
var didTapButton: ((SampleView) -> Void)?
private let button = UIButton()
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside)
}
private func setupUI() {
// setup UI
}
@objc private func buttonTapped() {
didTapButton?(self)
}
}
No result recorded yet. Added it? File a Tried-it report so the next person knows how it went in your editor.
Tried it
Reports from people who added this rule to their editor. They roll up into the badges above.
No one has filed a report yet. Try the prompt and be the first.
Related rules
- Autonomous coding agent that builds a verified app-builder harness
Master system prompt that directs an autonomous senior Python engineer to build a spec-driven, evidence-traced app-builder harness milestone by milestone without asking questions.
Coding · @mahfuzahmedog
- Find silent exception-handling smells in Python code
Scans Python files offline with ast to flag bare or swallowed excepts, silent fallbacks, lost causes, and other error-hiding patterns, returning file:line findings with severity and fix recipes.
Coding · @f
- Nginx config security review with fixes and checker script
Agent skill that reviews nginx configs for TLS, header, alias traversal, admin exposure and rate-limit problems, runs a stdlib checker, and returns a minimal route-preserving fixed config with reload and curl test steps.
Coding · @f
- Git repository bloat finder: diagnose large files and suggest safe cleanup
Agent skill that measures a Git repository, scans reachable blobs for large, deleted, versioned, generated and credential-like files, and proposes least-disruptive fixes without rewriting history itself.
Coding · @f
- Cursor rules guiding Swift UIKit MVVM apps with RxSwift
A .cursorrules rule file that makes Cursor act as an expert Swift iOS developer, writing UIKit code in MVVM with RxSwift bindings, following project structure, memory management, and testing conventions.
Coding · @patrickjs
License: CC0v1 · published Nov 29, 2026
Comments
No comments yet. If you tried this prompt, say how it went.