# \#mock

**URL:** https://forums.swift.org/tag/mock/498.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [canImport and SwiftUI Previews](https://forums.swift.org/t/canimport-and-swiftui-previews/68760)

<div class="topic-metadata">

**Author:** [@mapedd](https://forums.swift.org/u/mapedd)\
**Replies:** 5\
**Last updated:** [December 2, 2025, 1:27pm UTC](https://forums.swift.org/t/canimport-and-swiftui-previews/68760 "2025-12-02T13:27:56Z")

</div>

Hello all! I'm scratching my head with the problem: Is it possible to import a module that contains a sample preview data, let's call it Mocks, using #if canImport(Mocks) but only in DEBUG? Modules are setup using pa…

---

## [EXC\_BAD\_ACCESS Error in Xcode 16 with Testable Import and Mocking](https://forums.swift.org/t/exc-bad-access-error-in-xcode-16-with-testable-import-and-mocking/75362)

<div class="topic-metadata">

**Author:** [@brustolin](https://forums.swift.org/u/brustolin)\
**Replies:** 1\
**Last updated:** [October 14, 2024, 3:46pm UTC](https://forums.swift.org/t/exc-bad-access-error-in-xcode-16-with-testable-import-and-mocking/75362 "2024-10-14T15:46:45Z")

</div>

I’m working on a framework project with an unusual setup: The framework itself Two unit test targets An additional test library to share tools across the tests The test library uses @testable import MyFramework to moc…

---

## [Macro based networking framework with auto-generated services and mock services](https://forums.swift.org/t/macro-based-networking-framework-with-auto-generated-services-and-mock-services/71500)

<div class="topic-metadata">

**Author:** [@neothXT](https://forums.swift.org/u/neothXT)\
**Replies:** 1\
**Last updated:** [April 28, 2024, 1:48pm UTC](https://forums.swift.org/t/macro-based-networking-framework-with-auto-generated-services-and-mock-services/71500 "2024-04-28T13:48:43Z")

</div>

Hi! I'd like to let you know I've released Snowdrop v0.3.0. Most important features of this version (and Snowdrop in total) are: It's fully based on macros All you have to do is create a protocol declaring what method…

---

## [Implications of SE-0335 when implementing dependency injection](https://forums.swift.org/t/implications-of-se-0335-when-implementing-dependency-injection/57252)

<div class="topic-metadata">

**Author:** [@acecilia](https://forums.swift.org/u/acecilia)\
**Replies:** 5\
**Last updated:** [December 20, 2022, 12:03am UTC](https://forums.swift.org/t/implications-of-se-0335-when-implementing-dependency-injection/57252 "2022-12-20T00:03:48Z")

</div>

Hi :wave: I would like to get some feedback/guidelines on how to implement dependency injection now that SE-0335 has been accepted. I think the most widely accepted way of implementing dependency injection + tests does…

---

## [MockingKit - write interactive mocks for unit tests and to fake functionality](https://forums.swift.org/t/mockingkit-write-interactive-mocks-for-unit-tests-and-to-fake-functionality/45535)

<div class="topic-metadata">

**Author:** [@danielsaidi](https://forums.swift.org/u/danielsaidi)\
**Replies:** 0\
**Last updated:** [March 10, 2021, 1:51pm UTC](https://forums.swift.org/t/mockingkit-write-interactive-mocks-for-unit-tests-and-to-fake-functionality/45535 "2021-03-10T13:51:03Z")

</div>

Hi, I hope that this is not too off-topic for this forum. In that case, feel free to remove this topic and its tags. When I joined the iOS community in 2011, I came from .NET, where unit testing, tdd, mocking etc. were…
