<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/when-did-clean-code-still-turn-into-pain-later--pfvtgaupn" -->

---
title: When did “clean code” still turn into pain later?
description: Placing network calls and business logic in SwiftUI's onAppear lifecycle method led to duplicate executions when navigation and animations changed. The issue...
canonical: https://daily.dev/posts/when-did-clean-code-still-turn-into-pain-later--pfvtgaupn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: When did “clean code” still turn into pain later? | daily.dev
og:description: Placing network calls and business logic in SwiftUI's onAppear lifecycle method led to duplicate executions when navigation and animations changed. The issue...
og:url: https://daily.dev/posts/when-did-clean-code-still-turn-into-pain-later--pfvtgaupn
og:image: https://api.daily.dev/og/posts/pFVTGaupN.png
og:image:alt: When did “clean code” still turn into pain later?
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# When did “clean code” still turn into pain later?

**[Rebeloper](https://daily.dev/sources/rebeloper)** · 1 min read · 0 upvotes · 0 comments

## Summary

Placing network calls and business logic in SwiftUI's onAppear lifecycle method led to duplicate executions when navigation and animations changed. The issue stemmed from coupling side effects to view rendering. The solution involved separating UI description from business logic, moving effects outside of views to prevent unintended re-execution during view lifecycle changes.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=Pi4p6w_e2lo>

## Similar posts on daily.dev

- [3 Key Strategies to Make SwiftUI Views More Reusable](https://daily.dev/posts/3-key-strategies-to-make-swiftui-views-more-reusable-fm6itoo6h) · Matteo Manferdini · 5 upvotes · 0 comments
- [Borrowing from Kotlin/Android to Architect Scalable iOS Apps in SwiftUI](https://daily.dev/posts/borrowing-from-kotlin-android-to-architect-scalable-ios-apps-in-swiftui-zar5rarxu) · InfoQ · 0 upvotes · 0 comments
- [Two Files. One Difference. An 11× Bill You Never See.](https://daily.dev/posts/two-files-one-difference-an-11-bill-you-never-see--ei9uyurk1) · Medium · 0 upvotes · 0 comments

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#ios](https://daily.dev/tags/ios), [#swift](https://daily.dev/tags/swift), [#swiftui](https://daily.dev/tags/swiftui)

[View this post on daily.dev](https://daily.dev/posts/when-did-clean-code-still-turn-into-pain-later--pfvtgaupn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"When did “clean code” still turn into pain later?","url":"https://daily.dev/posts/when-did-clean-code-still-turn-into-pain-later--pfvtgaupn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/when-did-clean-code-still-turn-into-pain-later--pfvtgaupn"},"datePublished":"2026-02-04T05:37:37.994Z","dateModified":"2026-02-04T05:37:55.468Z","description":"Placing network calls and business logic in SwiftUI's onAppear lifecycle method led to duplicate executions when navigation and animations changed. The issue...","image":"https://i.ytimg.com/vi/Pi4p6w_e2lo/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/Pi4p6w_e2lo/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Rebeloper","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Rebeloper","logo":"https://media.daily.dev/image/upload/s--W0sZL8K4--/f_auto/v1726990075/logos/rebeloper","url":"https://daily.dev/sources/rebeloper"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/when-did-clean-code-still-turn-into-pain-later--pfvtgaupn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"architecture,ios,swift,swiftui","timeRequired":"PT1M","video":{"@type":"VideoObject","name":"When did “clean code” still turn into pain later?","description":"Placing network calls and business logic in SwiftUI's onAppear lifecycle method led to duplicate executions when navigation and animations changed. The issue...","thumbnailUrl":"https://i.ytimg.com/vi/Pi4p6w_e2lo/sddefault.jpg","uploadDate":"2026-02-04T05:37:37.994Z","duration":"PT1M","url":"https://api.daily.dev/r/pFVTGaupN","embedUrl":"https://www.youtube.com/embed/Pi4p6w_e2lo"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Rebeloper","item":"https://daily.dev/sources/rebeloper"},{"@type":"ListItem","position":3,"name":"When did “clean code” still turn into pain later?"}]}
```

