---
title: "Discussion on \"SwiftUI - Test drive the logic inside a view using TDD\" | Hashnode"
description: "Discussion on \"SwiftUI - Test drive the logic inside a view using TDD\". Problem: How test behavior inside a SwiftUI view ?\nSolution: Extract all the logic in a ViewModel and test drive only the behaviour using the TDD process !\nYou have this view to integrate \n\nSpecs for this design look like this:  \n\n- [ ] Display favor..."
url: "https://hashnode.com/posts/swiftui-test-drive-the-logic-inside-a-view-using-tdd/6295256224edeee34047e581"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [SwiftUI - Test drive the logic inside a view using TDD](https://swiftuicentral.com/swiftui-test-drive-the-logic-inside-a-view-using-tdd?utm_source=hashnode&utm_medium=feed)

Problem: How test behavior inside a SwiftUI view ? Solution: Extract all the logic in a ViewModel and test drive only the behaviour using the TDD process ! You have this view to integrate Specs for this design look like this: - \[ \] Display favor...

May 30, 2022 · 16 min read · swiftuicentral.com  
Read the article

-   [#swift](https://hashnode.com/tag/swift)
-   [#swiftui](https://hashnode.com/tag/swiftui)
-   [#tdd](https://hashnode.com/tag/tdd)
-   [#unit-testing](https://hashnode.com/tag/unit-testing)
-   [#ios](https://hashnode.com/tag/ios)

## Written by

[Alexandre Alcuvilla](https://hashnode.com/@screwdriver)

@screwdriver

  
[View profile](https://hashnode.com/@screwdriver)

#SwiftUI #Swift #DesignPattern #CleanArchi #iOS

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
