/ios-skills:arimunandar--vip-architecturefrom ios-skills
Implements VIP+W (View-Interactor-Presenter-Worker) Clean Architecture for iOS with unidirectional data flow and strict separation of concerns. Useful for building scalable, testable iOS apps.
Ships in ios-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A scalable, testable architecture pattern for iOS apps with strict separation of concerns and unidirectional data flow.
DisplayLogicBusinessLogicPresentationLogicWorkerLogicRoutingLogic, DataPassingProtocol┌───────────────────────────────────────────────────────────────┐
│ │
│ View ──request──► Interactor ──delegate──► Worker │
│ ▲ │ │ │
│ │ │◄─────result──────────┘ │
│ │ │ │
│ │ ▼ │
│ └──viewModel──── Presenter │
│ │
│ Router: Navigation between scenes (accessed via Interactor) │
│ │
└───────────────────────────────────────────────────────────────┘
SceneName/
├── SceneNameViewController.swift # View (DisplayLogic)
├── SceneNameInteractor.swift # Business Logic (BusinessLogic)
├── SceneNamePresenter.swift # Format for Display (PresentationLogic)
├── SceneNameWorker.swift # Async Operations (WorkerLogic)
├── SceneNameRouter.swift # Navigation (RoutingLogic)
├── SceneNameModels.swift # Request/Response/ViewModel
└── SceneNameConfigurator.swift # DI Assembly
protocol LoginDisplayLogic: AnyObject {
func displayLoginResult(viewModel: Login.Authenticate.ViewModel)
func displayValidationError(viewModel: Login.Validate.ViewModel)
func displayLoading(isLoading: Bool)
}
protocol LoginBusinessLogic {
func authenticate(request: Login.Authenticate.Request)
func validateInput(request: Login.Validate.Request)
}
protocol LoginPresentationLogic {
func presentLoginResult(response: Login.Authenticate.Response)
func presentValidationError(response: Login.Validate.Response)
func presentLoading(isLoading: Bool)
}
protocol LoginWorkerLogic {
func login(email: String, password: String) async throws -> User
func validateCredentials(email: String, password: String) -> ValidationResult
}
protocol LoginRoutingLogic {
func routeToHome()
func routeToForgotPassword()
func routeToSignup()
}
protocol LoginDataPassing {
var dataStore: LoginDataStore? { get }
}
protocol LoginDataStore {
var authenticatedUser: User? { get set }
}
import Foundation
enum Login {
// MARK: - Use Cases
enum Authenticate {
struct Request {
let email: String
let password: String
}
struct Response {
let result: Result<User, AuthError>
}
struct ViewModel {
let isSuccess: Bool
let errorMessage: String?
let welcomeMessage: String?
}
}
enum Validate {
struct Request {
let email: String
let password: String
}
struct Response {
let emailError: String?
let passwordError: String?
}
struct ViewModel {
let emailErrorText: String?
let passwordErrorText: String?
let isValid: Bool
}
}
}
import Foundation
protocol LoginWorkerLogic {
func login(email: String, password: String) async throws -> User
func validateCredentials(email: String, password: String) -> ValidationResult
}
final class LoginWorker: LoginWorkerLogic {
// MARK: - Dependencies
private let apiClient: APIClientProtocol
private let validator: CredentialValidatorProtocol
// MARK: - Init
init(
apiClient: APIClientProtocol = APIClient.shared,
validator: CredentialValidatorProtocol = CredentialValidator()
) {
self.apiClient = apiClient
self.validator = validator
}
// MARK: - WorkerLogic
func login(email: String, password: String) async throws -> User {
let request = LoginRequest(email: email, password: password)
let response: LoginResponse = try await apiClient.perform(request)
return response.user
}
func validateCredentials(email: String, password: String) -> ValidationResult {
validator.validate(email: email, password: password)
}
}
struct ValidationResult {
let emailError: String?
let passwordError: String?
var isValid: Bool {
emailError == nil && passwordError == nil
}
}
import Foundation
protocol LoginBusinessLogic {
func authenticate(request: Login.Authenticate.Request)
func validateInput(request: Login.Validate.Request)
}
protocol LoginDataStore {
var authenticatedUser: User? { get set }
}
final class LoginInteractor: LoginBusinessLogic, LoginDataStore {
// MARK: - Dependencies
var presenter: LoginPresentationLogic?
var worker: LoginWorkerLogic
// MARK: - DataStore
var authenticatedUser: User?
// MARK: - Init
init(worker: LoginWorkerLogic = LoginWorker()) {
self.worker = worker
}
// MARK: - BusinessLogic
func authenticate(request: Login.Authenticate.Request) {
presenter?.presentLoading(isLoading: true)
Task { @MainActor in
defer { presenter?.presentLoading(isLoading: false) }
do {
let user = try await worker.login(
email: request.email,
password: request.password
)
authenticatedUser = user
let response = Login.Authenticate.Response(result: .success(user))
presenter?.presentLoginResult(response: response)
} catch let error as AuthError {
let response = Login.Authenticate.Response(result: .failure(error))
presenter?.presentLoginResult(response: response)
} catch {
let response = Login.Authenticate.Response(result: .failure(.unknown))
presenter?.presentLoginResult(response: response)
}
}
}
func validateInput(request: Login.Validate.Request) {
let result = worker.validateCredentials(
email: request.email,
password: request.password
)
let response = Login.Validate.Response(
emailError: result.emailError,
passwordError: result.passwordError
)
presenter?.presentValidationError(response: response)
}
}
import Foundation
protocol LoginPresentationLogic {
func presentLoginResult(response: Login.Authenticate.Response)
func presentValidationError(response: Login.Validate.Response)
func presentLoading(isLoading: Bool)
}
final class LoginPresenter: LoginPresentationLogic {
// MARK: - Dependencies
weak var viewController: LoginDisplayLogic?
// MARK: - PresentationLogic
func presentLoginResult(response: Login.Authenticate.Response) {
let viewModel: Login.Authenticate.ViewModel
switch response.result {
case .success(let user):
viewModel = Login.Authenticate.ViewModel(
isSuccess: true,
errorMessage: nil,
welcomeMessage: "Welcome, \(user.name)!"
)
case .failure(let error):
viewModel = Login.Authenticate.ViewModel(
isSuccess: false,
errorMessage: error.localizedDescription,
welcomeMessage: nil
)
}
viewController?.displayLoginResult(viewModel: viewModel)
}
func presentValidationError(response: Login.Validate.Response) {
let viewModel = Login.Validate.ViewModel(
emailErrorText: response.emailError,
passwordErrorText: response.passwordError,
isValid: response.emailError == nil && response.passwordError == nil
)
viewController?.displayValidationError(viewModel: viewModel)
}
func presentLoading(isLoading: Bool) {
viewController?.displayLoading(isLoading: isLoading)
}
}
import UIKit
protocol LoginDisplayLogic: AnyObject {
func displayLoginResult(viewModel: Login.Authenticate.ViewModel)
func displayValidationError(viewModel: Login.Validate.ViewModel)
func displayLoading(isLoading: Bool)
}
final class LoginViewController: UIViewController {
// MARK: - VIP References
var interactor: LoginBusinessLogic?
var router: (LoginRoutingLogic & LoginDataPassing)?
// MARK: - UI Elements
private let emailTextField = UITextField()
private let passwordTextField = UITextField()
private let loginButton = UIButton(type: .system)
private let activityIndicator = UIActivityIndicatorView(style: .large)
private let emailErrorLabel = UILabel()
private let passwordErrorLabel = UILabel()
// MARK: - Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
setupActions()
}
// MARK: - Setup
private func setupUI() {
view.backgroundColor = .systemBackground
// Layout code here (see uikit-layouting skill)
}
private func setupActions() {
loginButton.addTarget(self, action: #selector(loginTapped), for: .touchUpInside)
emailTextField.addTarget(self, action: #selector(textFieldDidChange), for: .editingChanged)
passwordTextField.addTarget(self, action: #selector(textFieldDidChange), for: .editingChanged)
}
// MARK: - Actions
@objc private func loginTapped() {
let request = Login.Authenticate.Request(
email: emailTextField.text ?? "",
password: passwordTextField.text ?? ""
)
interactor?.authenticate(request: request)
}
@objc private func textFieldDidChange() {
let request = Login.Validate.Request(
email: emailTextField.text ?? "",
password: passwordTextField.text ?? ""
)
interactor?.validateInput(request: request)
}
}
// MARK: - DisplayLogic
extension LoginViewController: LoginDisplayLogic {
func displayLoginResult(viewModel: Login.Authenticate.ViewModel) {
if viewModel.isSuccess {
router?.routeToHome()
} else if let errorMessage = viewModel.errorMessage {
showAlert(title: "Error", message: errorMessage)
}
}
func displayValidationError(viewModel: Login.Validate.ViewModel) {
emailErrorLabel.text = viewModel.emailErrorText
passwordErrorLabel.text = viewModel.passwordErrorText
loginButton.isEnabled = viewModel.isValid
}
func displayLoading(isLoading: Bool) {
loginButton.isEnabled = !isLoading
if isLoading {
activityIndicator.startAnimating()
} else {
activityIndicator.stopAnimating()
}
}
private func showAlert(title: String, message: String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default))
present(alert, animated: true)
}
}
import UIKit
protocol LoginRoutingLogic {
func routeToHome()
func routeToForgotPassword()
func routeToSignup()
}
protocol LoginDataPassing {
var dataStore: LoginDataStore? { get }
}
final class LoginRouter: LoginRoutingLogic, LoginDataPassing {
// MARK: - Dependencies
weak var viewController: LoginViewController?
var dataStore: LoginDataStore?
// MARK: - Routing
func routeToHome() {
let destinationVC = HomeConfigurator.configure()
passDataToHome(destination: destinationVC)
navigateToHome(destination: destinationVC)
}
func routeToForgotPassword() {
let destinationVC = ForgotPasswordConfigurator.configure()
viewController?.navigationController?.pushViewController(destinationVC, animated: true)
}
func routeToSignup() {
let destinationVC = SignupConfigurator.configure()
viewController?.navigationController?.pushViewController(destinationVC, animated: true)
}
// MARK: - Navigation
private func navigateToHome(destination: HomeViewController) {
viewController?.navigationController?.setViewControllers([destination], animated: true)
}
// MARK: - Data Passing
private func passDataToHome(destination: HomeViewController) {
guard let user = dataStore?.authenticatedUser else { return }
destination.router?.dataStore?.currentUser = user
}
}
import UIKit
enum LoginConfigurator {
static func configure() -> LoginViewController {
let viewController = LoginViewController()
let interactor = LoginInteractor()
let presenter = LoginPresenter()
let router = LoginRouter()
let worker = LoginWorker()
// Connect VIP cycle
viewController.interactor = interactor
viewController.router = router
interactor.presenter = presenter
interactor.worker = worker
presenter.viewController = viewController
router.viewController = viewController
router.dataStore = interactor
return viewController
}
}
func fetchUser(id: String) async throws -> User {
try await apiClient.get("/users/\(id)")
}
func saveUser(_ user: User) async throws {
try await coreDataManager.save(user)
}
func loadCachedData() async throws -> Data {
try await fileManager.read(from: cacheURL)
}
func processImage(_ image: UIImage) async -> UIImage {
await Task.detached(priority: .userInitiated) {
image.applyFilters()
}.value
}
final class LoginInteractorTests: XCTestCase {
var sut: LoginInteractor!
var mockPresenter: MockLoginPresenter!
var mockWorker: MockLoginWorker!
override func setUp() {
mockPresenter = MockLoginPresenter()
mockWorker = MockLoginWorker()
sut = LoginInteractor(worker: mockWorker)
sut.presenter = mockPresenter
}
func testAuthenticateSuccess() async {
mockWorker.loginResult = .success(User.mock)
sut.authenticate(request: .init(email: "[email protected]", password: "password"))
await fulfillment(of: [mockPresenter.presentLoginResultCalled])
XCTAssertTrue(mockPresenter.lastLoginResponse?.result.isSuccess == true)
}
}
final class LoginPresenterTests: XCTestCase {
var sut: LoginPresenter!
var mockView: MockLoginViewController!
override func setUp() {
mockView = MockLoginViewController()
sut = LoginPresenter()
sut.viewController = mockView
}
func testPresentLoginResultSuccess() {
let response = Login.Authenticate.Response(result: .success(User.mock))
sut.presentLoginResult(response: response)
XCTAssertTrue(mockView.lastLoginViewModel?.isSuccess == true)
XCTAssertNotNil(mockView.lastLoginViewModel?.welcomeMessage)
}
}
interactor?.someMethod(request:)Before creating a new VIP+W scene, gather requirements using AskUserQuestion:
Question 1: Scene Purpose
Question 2: Data Requirements
Question 3: Navigation Pattern
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub jordancoin/ios-skills-collection --plugin ios-skills206 skills in this plugin
/aso-appstore-screenshotsGenerate high-converting App Store screenshots by analyzing your app's codebase, discovering core benefits, and creating ASO-optimized screenshot images using Nano Banana Pro./cleanseReview code for readability, then simplify it to be easy to follow and understand. Use this skill when the user wants to simplify code, improve readability, clean up for handoff, make code skimmable, reduce complexity, refactor for clarity, strip boilerplate, prepare code for future maintainers, or make a codebase easier to pick up. Trigger liberally — any request touching readability, simplification, cleanup, or "make this easier to understand" should use this skill. Also trigger when the user says things like "review this", "clean this up", "tidy this", "make this simpler", "reduce complexity", "flatten this", "strip the noise", or "I want to understand this code quickly next time I open it".
/critical-reasoningApply critical rationalist epistemology (Popper, Deutsch) to evaluate reasoning, identify errors, and refine understanding. Use when the user explicitly requests help with reasoning - phrases like "help me think this through", "does this make sense", "any flaws in this", "what am I missing", "critique this", "is this reasoning sound", "stress test this idea", "devil's advocate", or any request to evaluate arguments, identify logical problems, or improve thinking. Also use when errors in reasoning are significant enough to materially affect the user's goals, even if not explicitly requested.2 plugins ship this exact skill · first indexed Sep 10, 2026
Other plugins' skills for the same job