Mocksmith 1.0.0 is the first stable release of a compile-time protocol mocking framework for Swift 6.3.
Highlights
- Generate strict, type-safe protocol mocks with Swift macros, without Sourcery or checked-in generated source.
- Mock methods, properties, subscripts, static members, initializers, inherited protocols, associated types, generics, typed throws, rethrows, actors, parameter packs, and supported noncopyable requirements.
- Configure stubs with fixed, mixed, argument-dependent, throwing, producing, and FIFO suspended outcomes.
- Match and capture arguments with typed parameters, including value, predicate, identity, wildcard, and captor matching.
- Verify invocation counts, strict cross-mock call order, and exhaustive interaction coverage.
- Inspect typed call histories and wait asynchronously for matching calls with explicit timeouts.
- Control retained property state and pending async calls directly from tests.
- Choose strict behavior or opt-in defaults for unstubbed Void and optional-returning requirements.
- Integrate with Swift Testing or XCTest through dedicated adapters.
- Publish and control Combine AnyPublisher values through the optional MocksmithCombine product.
- Resolve inherited protocols and composition aliases across reachable SwiftPM source dependencies with the build plugin.
Requirements
- Swift 6.3
- iOS 17 or newer
- macOS 13 or newer
- tvOS 17 or newer
- watchOS 10 or newer
- Linux with Swift 6.3