{"id":29536783,"url":"https://github.com/danielcardonarojas/swift-mocking","last_synced_at":"2025-07-17T03:09:35.174Z","repository":{"id":304094013,"uuid":"1015424792","full_name":"DanielCardonaRojas/swift-mocking","owner":"DanielCardonaRojas","description":"A Swift mocking library powered by macros and parameter packs.","archived":false,"fork":false,"pushed_at":"2025-07-11T03:50:29.000Z","size":469,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-11T07:48:58.228Z","etag":null,"topics":["framework","macro","mock","mocking","mockito","parameter-packs","swift","testing"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanielCardonaRojas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-07T13:34:18.000Z","updated_at":"2025-07-11T03:50:31.000Z","dependencies_parsed_at":"2025-07-11T07:49:11.538Z","dependency_job_id":"b7fee5bd-f416-4139-8351-7c32441c9e51","html_url":"https://github.com/DanielCardonaRojas/swift-mocking","commit_stats":null,"previous_names":["danielcardonarojas/swift-mocking"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/DanielCardonaRojas/swift-mocking","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielCardonaRojas%2Fswift-mocking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielCardonaRojas%2Fswift-mocking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielCardonaRojas%2Fswift-mocking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielCardonaRojas%2Fswift-mocking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanielCardonaRojas","download_url":"https://codeload.github.com/DanielCardonaRojas/swift-mocking/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielCardonaRojas%2Fswift-mocking/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265562380,"owners_count":23788519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","macro","mock","mocking","mockito","parameter-packs","swift","testing"],"created_at":"2025-07-17T03:09:34.475Z","updated_at":"2025-07-17T03:09:35.168Z","avatar_url":"https://github.com/DanielCardonaRojas.png","language":"Swift","readme":"\n# SwiftMocking\n\n[![swift-version](https://img.shields.io/badge/swift-5.9-orange.svg)](https://img.shields.io/badge/swift-5.9-orange.svg)\n[![platforms](https://img.shields.io/badge/platforms-macOS%20%7C%20iOS%20%7C%20tvOS%20%7C%20watchOS-lightgrey.svg)](https://img.shields.io/badge/platforms-macOS%20%7C%20iOS%20%7C%20tvOS%20%7C%20watchOS-lightgrey.svg)\n[![license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://img.shields.io/badge/license-MIT-lightgrey.svg)\n[![CI Status](https://github.com/DanielCardonaRojas/swift-mocking/actions/workflows/pull_request.yml/badge.svg)](https://github.com/DanielCardonaRojas/swift-mocking/actions/workflows/pull_request.yml)\n\n\n`SwiftMocking` is a modern, type-safe mocking library for Swift that uses macros to provide a clean, readable, and efficient mocking experience. It offers an elegant API that leverages the power of [parameter packs](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0393-parameter-packs.md) and protocol witness structs provided by the companion package called [swift-witness](https://github.com/DanielCardonaRojas/swift-witness).\n\n---\n\n## ✨ Features\n\n| Feature | Description |\n| --- | --- |\n| **Type-Safe Mocking** | Uses [parameter packs](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0393-parameter-packs.md) to keep mocks synchronized with protocol definitions, preventing runtime errors. |\n| **Clean, Readable API** | Provides a Mockito-style API that makes tests expressive and easy to maintain. |\n| **No Preprocessor Macros** | Avoids `#if DEBUG` by using macros to generate code only where needed, resulting in a cleaner build process. |\n| **Target-Specific Generation**| Allows generates protocol witnesses for your main target and synthesizes mock conformances for your test target. |\n| **Flexible Argument Matching**| Offers powerful argument matchers like `.any` and `.equal`, with `ExpressibleBy...Literal` conformance for cleaner syntax. |\n| **Effect-Safe Spies** | Models effects like `async` and `throws` as phantom types, ensuring type safety when stubbing. |\n| **Compact Code Generation** | Keeps the generated code as small and compact as possible. |\n| **Descriptive Error Reporting** | Provides clear and informative error messages when assertions fail, making it easier to debug tests. |\n| **Options to configure the macro generated code** | Exposes the `MockableOptions` OptionSet that enables selecting what code gets generated . |\n\n---\n\n## 📦 Installation\n\nTo add `SwiftMocking` to your Swift package, add it as a dependency in your `Package.swift` file:\n\n```swift\n.package(url: \"https://github.com/DanielCardonaRojas/swift-mocking.git\", from: \"0.1.0\"),\n```\n\n---\n\n### Usage\n\nHere is an example of a `Store` class that uses the `PricingService`.\n\n```swift\nclass Store {\n    var items: [String] = []\n    var prices: [String: Int] =  [:]\n    let pricingService: any PricingService\n    init\u003cService: PricingService\u003e(pricingService: Service) {\n        self.pricingService = pricingService\n    }\n\n    func register(_ item: String) {\n        items.append(item)\n        let price = pricingService.price(for: item)\n        prices[item] = price\n    }\n}\n```\n\nIn your tests, you can use the generated `PricingServiceMock` to create a mock object and stub its functions.\n\n\n```swift\nimport SwiftMocking\nimport XCTest\n\nfinal class StoreTests: XCTestCase {\n    func testItemRegistration() {\n        let mock = PricingServiceMock()\n        let store = Store(pricingService: mock.instance)\n\n        // Stub specific calls\n        when(mock.price(for: \"apple\")).thenReturn(13)\n        when(mock.price(for: \"banana\")).thenReturn(17)\n\n        store.register(\"apple\")\n        store.register(\"banana\")\n\n        // Verify that price was called twice with any string\n        verify(mock.price(for: .any)).called(2) // .called(2) is equivalent to .called(.equal(2))\n\n        XCTAssertEqual(store.prices[\"apple\"], 13)\n        XCTAssertEqual(store.prices[\"banana\"], 17)\n    }\n}\n```\n\n---\n\n## ⚙️ How it Works\n\n`SwiftMocking` builds upon the powerful [swift-witness](https://github.com/DanielCardonaRojas/swift-witness) library to do the heavy lifting. `swift-witness` generates a struct with closures representing the protocol requirements. It also generates the code necessary to synthesize a protocol conformance (witness + Self). `swift-testing` takes advantage of this since it now only needs to create an instance of the witness and provide the correct context (the set of method spies that should be invoked).\n\n1.  **Protocol Analysis with `@Witnessed`**: The `@Witnessed` macro from the [swift-witness](https://github.com/DanielCardonaRojas/swift-witness) is responsible for analyzing the protocol and providing a mechanism for synthesizing protocol conformances.\n\n2.  **Mock Generation with `@Mockable`**: The `@Mockable` macro in this library then builds a witness value by passing in spies for each protocol requirement. These will power stubbing and spying of each protocol requirement.\n\nThis two-step process also enables different workflows. For example, you can annotate the protocol in your main target and generate both the witness which is useful for things other than testing and choose to generate the mock only in your test target. Or you can decide to generate both things in your main target. This enables that the core logic of protocol analysis is separate from the mock generation, and that your project only contains the code it needs for each specific target.\n\nFor a deeper understanding of protocol witnesses, please refer to the [swift-witness documentation](https://github.com/DanielCardonaRojas/ProtocolWitnessMacro?tab=readme-ov-file#-what-is-a-protocol-witness).\n\n---\n\n\n## 🚀 Example\n\nHere's an example of how to use `Mockable` to mock a `PricingService` protocol:\n\n```swift\nimport SwiftMocking\n\n@Mockable\nprotocol PricingService {\n    func price(for item: String) -\u003e Int\n}\n```\n\n### Generated Code\n\nThe `@Mockable` macro generates the following code:\n\n```swift\nstruct PricingServiceMock {\n    typealias Witness = PricingServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init(price: adapt(\\.price)))\n    }\n    let price = Spy\u003cString, None, Int\u003e()\n    func price(_ item: ArgMatcher\u003cString\u003e) -\u003e Interaction\u003cString, None, Int\u003e {\n        Interaction(item, spy: price)\n    }\n}\n```\n\nThe `@Witnessed` macro (used by `@Mockable` under the hood) generates the protocol witness. This code would typically be placed in your main **application target**, allowing you to use it for dependency injection.\n\n```swift\nstruct PricingServiceWitness\u003cA\u003e {\n    var price: (A, String) -\u003e Int\n\n    struct Synthesized: PricingService {\n        let context: A\n        let witness: PricingServiceWitness\n\n        func price(for item: String) -\u003e Int {\n            witness.price(context, item)\n        }\n    }\n}\n```\n\n## ⚡️ Advanced Usage\n\n### Advanced Argument Matching\n\n`Mockable` provides a rich set of argument matchers to precisely control stubbing and verification.\n\n#### Matching Any Argument\n\n```swift\n// Stub a method to return a value regardless of the input string\nwhen(mock.someMethod(.any)).thenReturn(10)\n\n// Verify a method was called with any integer argument\nverify(mock.anotherMethod(.any)).called()\n```\n\n#### Matching Specific Values (using `.equal` or literals)\n\n```swift\n// Stub a method to return 10 only when called with \"specific\"\nwhen(mock.someMethod(.equal(\"specific\"))).thenReturn(10)\n\n// Verify a method was called exactly with 42 (using literal conformance)\nverify(mock.anotherMethod(42)).called()\n```\n\n#### Matching Comparable Values (`.lessThan`, `.greaterThan`)\n\n```swift\n// Stub a method to return a value if the integer argument is less than 10\nwhen(mock.processValue(.lessThan(10))).thenReturn(\"small\")\n\n// Verify a method was called with an integer argument greater than 100\nverify(mock.processValue(.greaterThan(100))).called()\n```\n\n#### Matching Object Identity (`.identical`)\n\n```swift\nclass MyObject {}\nlet obj = MyObject()\n\n// Stub a method to return a value only when called with the exact instance 'obj'\nwhen(mock.handleObject(.identical(obj))).thenReturn(\"same instance\")\n```\n\n#### Matching Optional Values (`.notNil`, `.nil`)\n\n```swift\n// Verify a method was called with a non-nil optional string\nverify(mock.handleOptional(.notNil())).called()\n\n// Stub a method to return a default value when called with a nil optional integer\nwhen(mock.handleOptional(.nil())).thenReturn(0)\n```\n\n#### Matching Errors (`.anyError`, `.error`)\n\n```swift\nenum MyError: Error { case invalid }\n\n// Verify a method threw any error\nverify(mock.performAction()).throws(.anyError())\n\n// Verify a method threw an error of type MyError\nverify(mock.processData()).throws(.error(MyError.self))\n```\n\n### Dynamic Stubbing with `thenReturn` Closure\n\n\nA powerful feature of `SwiftMocking` is that you can define the return value of a stub dynamically based on the arguments passed to the mocked function. This is achieved by providing a closure to `thenReturn`.\n\nIt is common in other testing frameworks, that the parameters of this closure be of type Any. However, thanks to the use of parameter packs, the set of arguments here are concrete types, and are guaranteed to match the types of the function signature that is being stubbed. This essentially enables substituting the mocked function dynamically. For example:\n\n```swift\n@Mocked\nprotocol Calculator {\n    func calculate(a: Int, b: Int) -\u003e Int\n}\n\n// Calculate summing\nwhen(mock.calculate(a: .any, b: .any)).thenReturn { a, b in\n    // Note that not casting is required. a and here are of type Int\n    return a + b\n}\nXCTAssertEqual(mock.instance.calculate(a: 5, b: 10), 15)\n\n// Replace the calculation function\nwhen(mock.calculate(a: .any, b: .any)).thenReturn(*)\nXCTAssertEqual(mock.instance.calculate(a: 5, b: 10), 50)\n```\n\n### Default Values for Unstubbed Methods\n\n`SwiftMocking` provides a mechanism to return default values for methods that have not been explicitly stubbed. This is achieved through the `DefaultProvidable` protocol and the `DefaultProvidableRegistry`.\n\n-   **`DefaultProvidable` Protocol**: Types conforming to this protocol can provide a `defaultValue`.\n-   **`DefaultProvidableRegistry`**: This registry manages and provides access to default values for registered `DefaultProvidable` types.\n\nWithout a mechanism to provide default/fallback values when a method is not stubbed, calling the mock would unavoidably result in a `fatalError`.\n\nFor this reason, and to providide a less rigid testing experience, generated mocks include a `defaultProviderRegistry` property. This provides the flexibility of not having to stub every combination of arguments of a function, for certain return types.\n\n\nBy default, common Swift types like `String`, `Int`, `Double`, `Float`, `Bool`, `Optional`, `Array`, `Dictionary`, and `Set` conform to `DefaultProvidable` and are automatically registered.\n\n```swift\n// Assuming MyServiceMock is generated by @Mockable macro\nlet mock = MyServiceMock()\n\n// If 'fetchData' is not stubbed, and its return type (e.g., String) is DefaultProvidable,\n// it will return the default value for String (\"\")\nlet data = mock.fetchData() // data will be \"\"\n```\n\nYou can also register your custom types that conform to `DefaultProvidable`:\n\n```swift\nstruct MyCustomType: DefaultProvidable {\n    static var defaultValue: MyCustomType {\n        return MyCustomType(name: \"Default\", value: 0)\n    }\n    let name: String\n    let value: Int\n}\n\n// Register your custom type with the shared registry\nDefaultProvidableRegistry.shared.register(MyCustomType.self)\n\n// Now, if a method returns MyCustomType and is unstubbed, it will return MyCustomType.defaultValue\nlet customValue = mock.getCustomType() // customValue will be MyCustomType(name: \"Default\", value: 0)\n```\n\n### Descriptive Error Reporting\n\n`Mockable` provides detailed error messages when a test assertion fails. For example, if you expect a function to be called 4 times but it was only called twice, you'll get a clear message indicating the discrepancy.\n\n```swift\n// Example of a failing test\nverify(mock.price(for: .any)).called(4)\n```\n\nThis will produce the following error:\n\n```\nerror: Unfulfilled call count. Actual: 2\n```\n\n---\n\n### More Generated Code Examples\n\nHere are more examples of how `@Mockable` expands different protocol definitions:\n\n#### Method with `throws`\n\n```swift\n@Mockable\nprotocol PricingService {\n    func price(_ item: String) throws -\u003e Int\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\nprotocol PricingService {\n    func price(_ item: String) throws -\u003e Int\n}\n\nstruct PricingServiceMock {\n    typealias Witness = PricingServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init(price: adapt(\\.price)))\n    }\n    let price = Spy\u003cString, Throws, Int\u003e()\n    func price(_ item: ArgMatcher\u003cString\u003e) -\u003e Interaction\u003cString, Throws, Int\u003e {\n        Interaction(item, spy: price)\n    }\n}\n```\n\u003c/details\u003e\n\n#### Method with `async`\n\n```swift\n@Mockable\nprotocol PricingService {\n    func price(_ item: String) async -\u003e Int\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\nprotocol PricingService {\n    func price(_ item: String) async -\u003e Int\n}\n\nstruct PricingServiceMock {\n    typealias Witness = PricingServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init(price: adapt(\\.price)))\n    }\n    let price = Spy\u003cString, Async, Int\u003e()\n    func price(_ item: ArgMatcher\u003cString\u003e) -\u003e Interaction\u003cString, Async, Int\u003e {\n        Interaction(item, spy: price)\n    }\n}\n```\n\u003c/details\u003e\n\n#### Method with `async throws`\n\n```swift\n@Mockable\nprotocol PricingService {\n    func price(_ item: String) async throws -\u003e Int\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\nprotocol PricingService {\n    func price(_ item: String) async throws -\u003e Int\n}\n\nstruct PricingServiceMock {\n    typealias Witness = PricingServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init(price: adapt(\\.price)))\n    }\n    let price = Spy\u003cString, AsyncThrows, Int\u003e()\n    func price(_ item: ArgMatcher\u003cString\u003e) -\u003e Interaction\u003cString, AsyncThrows, Int\u003e {\n        Interaction(item, spy: price)\n    }\n}\n```\n\u003c/details\u003e\n\n#### Multiple Methods\n\n```swift\n@Mockable\nprotocol FeedService {\n    func fetch(from url: URL) async throws -\u003e Data\n    func post(to url: URL, data: Data) async throws\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\nprotocol FeedService {\n    func fetch(from url: URL) async throws -\u003e Data\n    func post(to url: URL, data: Data) async throws\n}\n\nstruct FeedServiceMock {\n    typealias Witness = FeedServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init(fetch: adapt(\\.fetch), post: adapt(\\.post)))\n    }\n    let fetch = Spy\u003cURL, AsyncThrows, Data\u003e()\n    func fetch(from url: ArgMatcher\u003cURL\u003e) -\u003e Interaction\u003cURL, AsyncThrows, Data\u003e {\n        Interaction(url, spy: fetch)\n    }\n    let post = Spy\u003cURL, Data, AsyncThrows, Void\u003e()\n    func post(to url: ArgMatcher\u003cURL\u003e, data: ArgMatcher\u003cData\u003e) -\u003e Interaction\u003cURL, Data, AsyncThrows, Void\u003e {\n        Interaction(url, data, spy: post)\n    }\n}\n```\n\u003c/details\u003e\n\n#### Method with No Parameters and No Return\n\n```swift\n@Mockable\nprotocol Service {\n    func doSomething()\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\nprotocol Service {\n    func doSomething()\n}\n\nstruct ServiceMock {\n    typealias Witness = ServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init(doSomething: adapt(\\.doSomething_)))\n    }\n    let doSomething_ = Spy\u003cNone, Void\u003e()\n    func doSomething() -\u003e Interaction\u003cNone, Void\u003e {\n        Interaction(spy: doSomething_)\n    }\n}\n```\n\u003c/details\u003e\n\n#### Macro Option: `.prefixMock`\n\n```swift\n@Mockable([.prefixMock])\nprotocol MyService {\n    func doSomething()\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\nprotocol MyService {\n    func doSomething()\n}\n\nstruct MockMyService {\n    typealias Witness = MyServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init(doSomething: adapt(\\.doSomething_)))\n    }\n    let doSomething_ = Spy\u003cNone, Void\u003e()\n    func doSomething() -\u003e Interaction\u003cNone, Void\u003e {\n        Interaction(spy: doSomething_)\n    }\n}\n```\n\u003c/details\u003e\n\n#### Protocol with Associated Type\n\n```swift\n@Mockable\nprotocol MyService {\n    associatedtype Item\n    func item() -\u003e Item\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\nprotocol MyService {\n    associatedtype Item\n    func item() -\u003e Item\n}\n\nstruct MyServiceMock {\n    typealias Witness = MyServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init(item: adapt(\\.item_)))\n    }\n    let item_ = Spy\u003cNone, Item\u003e()\n    func item() -\u003e Interaction\u003cNone, Item\u003e {\n        Interaction(spy: item_)\n    }\n}\n```\n\u003c/details\u003e\n\n#### Protocol with Property\n\n```swift\n@Mockable\nprotocol MyService {\n    var value: Int { get }\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\nprotocol MyService {\n    var value: Int { get }\n}\n\nstruct MyServiceMock {\n    typealias Witness = MyServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init())\n    }\n}\n```\n\u003c/details\u003e\n\n#### Protocol with Initializer\n\n```swift\n@Mockable\nprotocol MyService {\n    init(value: Int)\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\nprotocol MyService {\n    init(value: Int)\n}\n\nstruct MyServiceMock {\n    typealias Witness = MyServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init())\n    }\n}\n```\n\u003c/details\u003e\n\n#### Protocol with Subscript\n\n```swift\n@Mockable\nprotocol MyService {\n    subscript(index: Int) -\u003e String { get }\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\nprotocol MyService {\n    subscript(index: Int) -\u003e String { get }\n}\n\nstruct MyServiceMock {\n    typealias Witness = MyServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init())\n    }\n}\n```\n\u003c/details\u003e\n\n#### Public Protocol\n\n```swift\n@Mockable\npublic protocol Service {\n    func doSomething()\n}\n```\n\u003cdetails\u003e\n\u003csummary\u003eGenerated Code\u003c/summary\u003e\n\n```swift\npublic protocol Service {\n    func doSomething()\n}\n\nstruct ServiceMock {\n    typealias Witness = ServiceWitness\u003cSelf\u003e\n    var instance: Witness.Synthesized {\n        .init(context: self, witness: .init(doSomething: adapt(\\.doSomething_)))\n    }\n    let doSomething_ = Spy\u003cNone, Void\u003e()\n    func doSomething() -\u003e Interaction\u003cNone, Void\u003e {\n        Interaction(spy: doSomething_)\n    }\n}\n```\n\u003c/details\u003e\n\n\n## 📚 Documentation\n\nFor more detailed information, please refer to the official [documentation](https://danielcardonarojas.github.io/swift-mocking/documentation/mockabletypes/).\n\n## 📜 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielcardonarojas%2Fswift-mocking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielcardonarojas%2Fswift-mocking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielcardonarojas%2Fswift-mocking/lists"}