Skip to content
0:00 / 0:00

#swiftui#stateobject#observedobject

8 Common SwiftUI Mistakes – and how to fix them!

Paul Hudson

122K subscribers • 6 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Paul Hudson, creator of Hacking with Swift
  • May be out of date. Uploaded 6 years ago, in an area where tools change fast.

Intermediate. Assumes working knowledge.

52K views6 years ago1 recommendation

Mobile developmentTools and practiceSwiftiOS and SwiftUIDebugging

Paul Hudson explains eight frequent mistakes developers make when learning SwiftUI, from modifier ordering to state management, and how to resolve them.

SwiftUI is a big and complex framework, and although it’s great fun to work with there’s also a lot of scope for making mistakes. In this article I’m going to walk through 8 common mistakes SwiftUI learners make, and how to fix them. – Adding views and modifiers where they aren't needed – Using @ObservedObject when they mean @StateObject – Putting modifiers in the wrong order – Attaching property observers to property wrappers – Stroking shapes when you mean to stroke their border – Using alerts and sheets with optionals – Trying to get "behind" their SwiftUI views – Creating dynamic views with invalid ranges

Why it's here

1 person recommends this

What people say. Recommended as an essential watch for avoiding common pitfalls and understanding state management in SwiftUI.

u/AnotherThrowAway_9in r/swift • Recommends

HackingWithSwift: 8 Common SwiftUI Mistakes – and how to fix them!