Большая и полезная статья с примерами кода, в которой рассматриваются важные моменты, которые помогут вам повысить производительность и эффективность разработки.
• Which architecture is better: Redux or MVVM?
• Use
@StateObject and @ObservableObject• Create
@Published variable with care• Breaking down the content of the body into smaller to minimize the compilation time
• Prefer
@State for the animations instead of @Published• Declare Observable objects at a specific place to avoid unnecessary UI update
• Find which data change is causing a SwiftUI view to update
• Use LazyHStack and LazyVStack if you have a long list
• Is there anything similar to viewDidLoad()?
• Use UIKit components directly in SwiftUI
• Conditional modifier
• Avoid using .padding and .frame together
• Use GeometryReader wisely
• Use AnyView occasionally
• Must use ID with Foreach and List
• Prefer using Text over Label
• Use Group to return multiple view instances
• Use .fixedSize() to specify that the frame doesn’t change
Перевод от AppTractor → Мастерство работы в SwiftUI
Читать (En)
