This file provides guidance to AI agents when working with code in this repository.
WordPress for iOS is the official mobile app for WordPress that lets users create, manage, and publish content to their WordPress websites directly from their iPhone or iPad.
Minimum requires iOS version is iOS 17. The latest iOS version is iOS 26.
WordPress-iOS uses a modular architecture with the main app and separate Swift packages:
- Main App:
WordPress/Classes/- core app functionality - Modules:
Modules/Sources/- Reusable Swift packages including:WordPressUI- shared UI componentsWordPressFlux- deprecated state management using Flux pattern (DO NOT USE)WordPressKit- API client and networkingWordPressShared- Shared utilitiesDesignSystem- design system
- Architecture: SwiftUI with MVVM for new features
- ViewModels: Use
@MainActorclass conforming toObservableObjectwith@Publishedproperties - Concurrency: Swift async/await patterns with
@MainActorfor UI thread safety - Navigation: SwiftUI NavigationStack
- Persistence: Core Data with
@FetchRequestfor SwiftUI integration - UI: Progressive SwiftUI adoption using
UIHostingControllerbridge pattern - Dependency Injection: Constructor injection with protocol-based services
- Use Swift Testing for new tests
- Multi-site Support: Code must handle both WordPress.com and self-hosted sites
- Accessibility: Use proper accessibility labels and traits
- Localization: follow best practices from @docs/localization.md
WordPressbuilds the WordPress iOS app and runsWordPressUnitTests.xctestplan— default for builds and the full unit test suite.Jetpackbuilds the Jetpack iOS app — switch to it for Jetpack-only work.- Some test targets (e.g.
WordPressDataTests) have their own scheme and aren't inWordPressUnitTests.xctestplan. If theWordPressscheme fails to build because of an unrelated target, fall back to the target's dedicated scheme.
To automatically sign in to the app on an iOS simulator, see @docs/simulator-sign-in.md.
The wordpress-rs Swift package provides the WordPressAPI and WordPressAPIInternal modules and includes an xcframework target. Builds occasionally fail with an error like:
File '/path/to/libwordpressFFI/wp_api_uniffi.h' has been modified since the module file '/path/to/libwordpressFFI-[random].pcm' was built.
To recover, delete all *.pcm files in the directory reported by the error and rebuild.
- Follow Swift API Design Guidelines
- Use strict access control modifiers where possible
- Use four spaces (not tabs)
- Lines should not have trailing whitespace
- Follow the standard formatting practices enforced by SwiftLint
- Don't create
bodyforViewthat are too long - Use semantics text sizes like
.headline - Use swift-log (see the
WordPress/Classes/System/Logging.swiftfile) instead of CocoaLumberjack (DDLogError, etc)
- Branch from
trunk(main branch) - PR target should be
trunk - When writing commit messages, never include references to Claude